| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | #include "allegro/file.h" | ||
| 2 | #include "base/flags.h" | ||
| 3 | #include "base/general.h" | ||
| 4 | #include "base/util.h" | ||
| 5 | #include "base/version.h" | ||
| 6 | #include "base/zapp.h" | ||
| 7 | #include "base/qrs.h" | ||
| 8 | #include "base/cpool.h" | ||
| 9 | #include "base/autocombo.h" | ||
| 10 | #include "base/packfile.h" | ||
| 11 | #include "base/dmap.h" | ||
| 12 | #include "base/combo.h" | ||
| 13 | #include "base/msgstr.h" | ||
| 14 | #include "base/flags.h" | ||
| 15 | #include <bit> | ||
| 16 | #include <filesystem> | ||
| 17 | #include <memory> | ||
| 18 | #include <optional> | ||
| 19 | #include <stdio.h> | ||
| 20 | #include <cstring> | ||
| 21 | #include <string> | ||
| 22 | #include <map> | ||
| 23 | #include <vector> | ||
| 24 | #include <assert.h> | ||
| 25 | #include <fmt/format.h> | ||
| 26 | |||
| 27 | |||
| 28 | #include "fmt/core.h" | ||
| 29 | #include "base/zc_alleg.h" | ||
| 30 | #include "base/zdefs.h" | ||
| 31 | #include "base/colors.h" | ||
| 32 | #include "tiles.h" | ||
| 33 | #include "base/zsys.h" | ||
| 34 | #include "base/qst.h" | ||
| 35 | #include "defdata.h" | ||
| 36 | #include "subscr.h" | ||
| 37 | #include "sfx.h" | ||
| 38 | #include "base/md5.h" | ||
| 39 | #include "zc/replay.h" | ||
| 40 | #include "zc/zelda.h" | ||
| 41 | #include "zinfo.h" | ||
| 42 | #include "zc/ffscript.h" | ||
| 43 | #include "particles.h" | ||
| 44 | #include "dialog/alert.h" | ||
| 45 | #include "base/misctypes.h" | ||
| 46 | #include "base/initdata.h" | ||
| 47 | |||
| 48 | extern sprite_list guys, items, Ewpns, Lwpns, chainlinks, decorations; | ||
| 49 | extern void setZScriptVersion(int32_t s_version); | ||
| 50 | |||
| 51 | static bool read_ext_zinfo = false, read_zinfo = false; | ||
| 52 | static bool loadquest_report = false; | ||
| 53 | static char const* loading_qst_name = NULL; | ||
| 54 | static std::string last_loaded_qstpath; | ||
| 55 | static byte loading_qst_num = 0; | ||
| 56 | static byte subscr_mode = ssdtMAX; | ||
| 57 | // Very old quests only used a byte for combos, and each screen had a "combo page" to vary | ||
| 58 | // what combos were used. This vector just lets us convert those old quests on load. | ||
| 59 | static std::vector<byte> old_combo_pages; | ||
| 60 | |||
| 61 | dword loading_tileset_flags = 0; | ||
| 62 | |||
| 63 | int32_t First[MAX_COMBO_COLS]={0},combo_alistpos[MAX_COMBO_COLS]={0},combo_pool_listpos[MAX_COMBO_COLS]={0},combo_auto_listpos[MAX_COMBO_COLS]={0}; | ||
| 64 | map_and_screen map_page[MAX_MAPPAGE_BTNS]= {{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}}; | ||
| 65 | |||
| 66 | #ifdef _MSC_VER | ||
| 67 | #define strncasecmp _strnicmp | ||
| 68 | #endif | ||
| 69 | |||
| 70 | #ifndef _AL_MALLOC | ||
| 71 | #define _AL_MALLOC(a) _al_malloc(a) | ||
| 72 | #define _AL_FREE(a) _al_free(a) | ||
| 73 | #endif | ||
| 74 | |||
| 75 | using std::string; | ||
| 76 | using std::pair; | ||
| 77 | |||
| 78 | extern int32_t hero_animation_speed; //lower is faster animation | ||
| 79 | extern byte *colordata; | ||
| 80 | extern tiledata *newtilebuf; | ||
| 81 | extern byte *trashbuf; | ||
| 82 | extern itemdata *itemsbuf; | ||
| 83 | extern wpndata *wpnsbuf; | ||
| 84 | extern comboclass *combo_class_buf; | ||
| 85 | extern guydata *guysbuf; | ||
| 86 | extern ZCHEATS zcheats; | ||
| 87 | extern char palnames[MAXLEVELS][17]; | ||
| 88 | extern char *byte_conversion(int32_t number, int32_t format); | ||
| 89 | extern char *byte_conversion2(int32_t number1, int32_t number2, int32_t format1, int32_t format2); | ||
| 90 | string zScript; | ||
| 91 | 424 | std::map<int32_t, script_slot_data > ffcmap; | |
| 92 | 424 | std::map<int32_t, script_slot_data > globalmap; | |
| 93 | 424 | std::map<int32_t, script_slot_data > genericmap; | |
| 94 | 424 | std::map<int32_t, script_slot_data > itemmap; | |
| 95 | 424 | std::map<int32_t, script_slot_data > npcmap; | |
| 96 | 424 | std::map<int32_t, script_slot_data > ewpnmap; | |
| 97 | 424 | std::map<int32_t, script_slot_data > lwpnmap; | |
| 98 | 424 | std::map<int32_t, script_slot_data > playermap; | |
| 99 | 424 | std::map<int32_t, script_slot_data > dmapmap; | |
| 100 | 424 | std::map<int32_t, script_slot_data > screenmap; | |
| 101 | 424 | std::map<int32_t, script_slot_data > itemspritemap; | |
| 102 | 424 | std::map<int32_t, script_slot_data > comboscriptmap; | |
| 103 | 424 | std::map<int32_t, script_slot_data > subscreenmap; | |
| 104 | void free_newtilebuf(); | ||
| 105 | bool combosread=false; | ||
| 106 | bool mapsread=false; | ||
| 107 | bool fixffcs=false; | ||
| 108 | bool fixpolsvoice=false; | ||
| 109 | |||
| 110 | // Each section had a separate, secondary versioning number, but it was never really utilized for | ||
| 111 | // its intended purpose so it's been removed. But we still write something in this field. | ||
| 112 | 232 | bool write_deprecated_section_cversion(word section_version, PACKFILE* f) | |
| 113 | { | ||
| 114 | 232 | return p_iputw(section_version, f); | |
| 115 | } | ||
| 116 | |||
| 117 | 14507 | bool read_deprecated_section_cversion(PACKFILE* f) | |
| 118 | { | ||
| 119 | word unused; | ||
| 120 | 14507 | return p_igetw(&unused, f); | |
| 121 | } | ||
| 122 | |||
| 123 | 21994 | void script_slot_data::update() | |
| 124 | { | ||
| 125 |
2/3✗ Branch 0 not taken.
✓ Branch 1 taken 7 times.
✓ Branch 2 taken 21987 times.
|
21994 | switch (format) |
| 126 | { | ||
| 127 | case SCRIPT_FORMAT_INVALID: | ||
| 128 | 7 | output = fmt::format("{} --{}", slotname, scriptname); | |
| 129 | 7 | break; | |
| 130 | 21987 | case SCRIPT_FORMAT_DEFAULT: | |
| 131 | default: | ||
| 132 | 21987 | output = fmt::format("{} {}", slotname, scriptname); | |
| 133 | 21987 | } | |
| 134 | 21994 | } | |
| 135 | |||
| 136 | char qstdat_string[2048] = { 0 }; | ||
| 137 | |||
| 138 | static zinfo* load_tmp_zi = NULL; | ||
| 139 | |||
| 140 | int32_t memDBGwatch[8]= {0,0,0,0,0,0,0,0}; //So I can monitor memory crap | ||
| 141 | const byte clavio[9]={97,109,111,110,103,117,115,0}; | ||
| 142 | |||
| 143 | //enum { qe_OK, qe_notfound, qe_invalid, qe_version, qe_obsolete, | ||
| 144 | // qe_missing, qe_internal, qe_pwd, qe_match, qe_minver }; | ||
| 145 | |||
| 146 | const char *qst_error[] = | ||
| 147 | { | ||
| 148 | "OK","File not found","Invalid quest file", | ||
| 149 | "Version not supported","Obsolete version", | ||
| 150 | "Missing new data" , /* but let it pass in ZQuest */ | ||
| 151 | "Internal error occurred", "Invalid password", | ||
| 152 | "Quest title doesn't match saved game", "Save file is for older version of quest; please start new save", | ||
| 153 | "Out of memory", "File Debug Mode", "Canceled", "", "No quest assigned" | ||
| 154 | }; | ||
| 155 | |||
| 156 | //for legacy quests -DD | ||
| 157 | enum { ssiBOMB, ssiSWORD, ssiSHIELD, ssiCANDLE, ssiLETTER, ssiPOTION, ssiLETTERPOTION, ssiBOW, ssiARROW, ssiBOWANDARROW, ssiBAIT, ssiRING, ssiBRACELET, ssiMAP, | ||
| 158 | ssiCOMPASS, ssiBOSSKEY, ssiMAGICKEY, ssiBRANG, ssiWAND, ssiRAFT, ssiLADDER, ssiWHISTLE, ssiBOOK, ssiWALLET, ssiSBOMB, ssiHCPIECE, ssiAMULET, ssiFLIPPERS, | ||
| 159 | ssiHOOKSHOT, ssiLENS, ssiHAMMER, ssiBOOTS, ssiDIVINEFIRE, ssiDIVINEESCAPE, ssiDIVINEPROTECTION, ssiQUIVER, ssiBOMBBAG, ssiCBYRNA, ssiROCS, ssiHOVERBOOTS, | ||
| 160 | ssiSPINSCROLL, ssiCROSSSCROLL, ssiQUAKESCROLL, ssiWHISPRING, ssiCHARGERING, ssiPERILSCROLL, ssiWEALTHMEDAL, ssiHEARTRING, ssiMAGICRING, ssiSPINSCROLL2, | ||
| 161 | ssiQUAKESCROLL2, ssiAGONY, ssiSTOMPBOOTS, ssiWHIMSICALRING, ssiPERILRING, ssiMAX | ||
| 162 | }; | ||
| 163 | |||
| 164 | static byte deprecated_rules[QUESTRULES_NEW_SIZE]; | ||
| 165 | |||
| 166 | |||
| 167 | ✗ | char *byte_conversion(int32_t number, int32_t format) | |
| 168 | { | ||
| 169 | static char num_str[40]; | ||
| 170 | |||
| 171 | ✗ | if(format==-1) //auto | |
| 172 | { | ||
| 173 | ✗ | format=1; //bytes | |
| 174 | |||
| 175 | ✗ | if(number>1024) | |
| 176 | { | ||
| 177 | ✗ | format=2; //kilobytes | |
| 178 | ✗ | } | |
| 179 | |||
| 180 | ✗ | if(number>1024*1024) | |
| 181 | { | ||
| 182 | ✗ | format=3; //megabytes | |
| 183 | ✗ | } | |
| 184 | |||
| 185 | ✗ | if(number>1024*1024*1024) | |
| 186 | { | ||
| 187 | ✗ | format=4; //gigabytes (dude, what are you doing?) | |
| 188 | ✗ | } | |
| 189 | ✗ | } | |
| 190 | |||
| 191 | ✗ | switch(format) | |
| 192 | { | ||
| 193 | case 1: //bytes | ||
| 194 | ✗ | sprintf(num_str,"%db",number); | |
| 195 | ✗ | break; | |
| 196 | |||
| 197 | case 2: //kilobytes | ||
| 198 | ✗ | sprintf(num_str,"%.2fk",float(number)/1024); | |
| 199 | ✗ | break; | |
| 200 | |||
| 201 | case 3: //megabytes | ||
| 202 | ✗ | sprintf(num_str,"%.2fM",float(number)/(1024*1024)); | |
| 203 | ✗ | break; | |
| 204 | |||
| 205 | case 4: //gigabytes | ||
| 206 | ✗ | sprintf(num_str,"%.2fG",float(number)/(1024*1024*1024)); | |
| 207 | ✗ | break; | |
| 208 | |||
| 209 | default: | ||
| 210 | ✗ | abort(); | |
| 211 | break; | ||
| 212 | } | ||
| 213 | |||
| 214 | ✗ | return num_str; | |
| 215 | } | ||
| 216 | |||
| 217 | ✗ | char *byte_conversion2(int32_t number1, int32_t number2, int32_t format1, int32_t format2) | |
| 218 | { | ||
| 219 | static char num_str1[40]; | ||
| 220 | static char num_str2[40]; | ||
| 221 | static char num_str[80]; | ||
| 222 | |||
| 223 | ✗ | if(format1==-1) //auto | |
| 224 | { | ||
| 225 | ✗ | format1=1; //bytes | |
| 226 | |||
| 227 | ✗ | if(number1>1024) | |
| 228 | { | ||
| 229 | ✗ | format1=2; //kilobytes | |
| 230 | ✗ | } | |
| 231 | |||
| 232 | ✗ | if(number1>1024*1024) | |
| 233 | { | ||
| 234 | ✗ | format1=3; //megabytes | |
| 235 | ✗ | } | |
| 236 | |||
| 237 | ✗ | if(number1>1024*1024*1024) | |
| 238 | { | ||
| 239 | ✗ | format1=4; //gigabytes (dude, what are you doing?) | |
| 240 | ✗ | } | |
| 241 | ✗ | } | |
| 242 | |||
| 243 | ✗ | if(format2==-1) //auto | |
| 244 | { | ||
| 245 | ✗ | format2=1; //bytes | |
| 246 | |||
| 247 | ✗ | if(number2>1024) | |
| 248 | { | ||
| 249 | ✗ | format2=2; //kilobytes | |
| 250 | ✗ | } | |
| 251 | |||
| 252 | ✗ | if(number2>1024*1024) | |
| 253 | { | ||
| 254 | ✗ | format2=3; //megabytes | |
| 255 | ✗ | } | |
| 256 | |||
| 257 | ✗ | if(number2>1024*1024*1024) | |
| 258 | { | ||
| 259 | ✗ | format2=4; //gigabytes (dude, what are you doing?) | |
| 260 | ✗ | } | |
| 261 | ✗ | } | |
| 262 | |||
| 263 | ✗ | switch(format1) | |
| 264 | { | ||
| 265 | case 1: //bytes | ||
| 266 | ✗ | sprintf(num_str1,"%db",number1); | |
| 267 | ✗ | break; | |
| 268 | |||
| 269 | case 2: //kilobytes | ||
| 270 | ✗ | sprintf(num_str1,"%.2fk",float(number1)/1024); | |
| 271 | ✗ | break; | |
| 272 | |||
| 273 | case 3: //megabytes | ||
| 274 | ✗ | sprintf(num_str1,"%.2fM",float(number1)/(1024*1024)); | |
| 275 | ✗ | break; | |
| 276 | |||
| 277 | case 4: //gigabytes | ||
| 278 | ✗ | sprintf(num_str1,"%.2fG",float(number1)/(1024*1024*1024)); | |
| 279 | ✗ | break; | |
| 280 | |||
| 281 | default: | ||
| 282 | ✗ | abort(); | |
| 283 | break; | ||
| 284 | } | ||
| 285 | |||
| 286 | ✗ | switch(format2) | |
| 287 | { | ||
| 288 | case 1: //bytes | ||
| 289 | ✗ | sprintf(num_str2,"%db",number2); | |
| 290 | ✗ | break; | |
| 291 | |||
| 292 | case 2: //kilobytes | ||
| 293 | ✗ | sprintf(num_str2,"%.2fk",float(number2)/1024); | |
| 294 | ✗ | break; | |
| 295 | |||
| 296 | case 3: //megabytes | ||
| 297 | ✗ | sprintf(num_str2,"%.2fM",float(number2)/(1024*1024)); | |
| 298 | ✗ | break; | |
| 299 | |||
| 300 | case 4: //gigabytes | ||
| 301 | ✗ | sprintf(num_str2,"%.2fG",float(number2)/(1024*1024*1024)); | |
| 302 | ✗ | break; | |
| 303 | |||
| 304 | default: | ||
| 305 | ✗ | abort(); | |
| 306 | break; | ||
| 307 | } | ||
| 308 | |||
| 309 | ✗ | sprintf(num_str, "%s/%s", num_str1, num_str2); | |
| 310 | ✗ | return num_str; | |
| 311 | } | ||
| 312 | |||
| 313 | ✗ | char *ordinal(int32_t num) | |
| 314 | { | ||
| 315 | static const char *ending[4] = {"st","nd","rd","th"}; | ||
| 316 | static char ord_str[8]; | ||
| 317 | |||
| 318 | char *end; | ||
| 319 | ✗ | int32_t t=(num%100)/10; | |
| 320 | ✗ | int32_t n=num%10; | |
| 321 | |||
| 322 | ✗ | if(n>=1 && n<4 && t!=1) | |
| 323 | ✗ | end = (char *)ending[n-1]; | |
| 324 | else | ||
| 325 | ✗ | end = (char *)ending[3]; | |
| 326 | |||
| 327 | ✗ | sprintf(ord_str,"%d%s",num%10000,end); | |
| 328 | ✗ | return ord_str; | |
| 329 | } | ||
| 330 | |||
| 331 | ✗ | int32_t get_version_and_build(PACKFILE *f, word *version, word *build) | |
| 332 | { | ||
| 333 | int32_t ret; | ||
| 334 | ✗ | *version=0; | |
| 335 | ✗ | *build=0; | |
| 336 | ✗ | byte temp_map_count=map_count; | |
| 337 | byte temp_midi_flags[MIDIFLAGS_SIZE]; | ||
| 338 | ✗ | memcpy(temp_midi_flags, midi_flags, MIDIFLAGS_SIZE); | |
| 339 | |||
| 340 | ✗ | zquestheader tempheader{}; | |
| 341 | |||
| 342 | ✗ | if(!f) | |
| 343 | { | ||
| 344 | ✗ | return qe_invalid; | |
| 345 | } | ||
| 346 | |||
| 347 | ✗ | ret=readheader(f, &tempheader); | |
| 348 | |||
| 349 | ✗ | if(ret) | |
| 350 | { | ||
| 351 | ✗ | return ret; | |
| 352 | } | ||
| 353 | |||
| 354 | ✗ | map_count=temp_map_count; | |
| 355 | ✗ | memcpy(midi_flags, temp_midi_flags, MIDIFLAGS_SIZE); | |
| 356 | ✗ | *version=tempheader.zelda_version; | |
| 357 | ✗ | *build=tempheader.build; | |
| 358 | ✗ | return 0; | |
| 359 | ✗ | } | |
| 360 | |||
| 361 | |||
| 362 | ✗ | bool find_section(PACKFILE *f, int32_t section_id_requested) | |
| 363 | { | ||
| 364 | |||
| 365 | ✗ | if(!f) | |
| 366 | { | ||
| 367 | ✗ | return false; | |
| 368 | } | ||
| 369 | |||
| 370 | int32_t section_id_read; | ||
| 371 | ✗ | bool catchup=false; | |
| 372 | word dummy; | ||
| 373 | byte tempbyte; | ||
| 374 | char tempbuf[65536]; | ||
| 375 | |||
| 376 | |||
| 377 | ✗ | switch(section_id_requested) | |
| 378 | { | ||
| 379 | case ID_RULES: | ||
| 380 | case ID_STRINGS: | ||
| 381 | case ID_MISC: | ||
| 382 | case ID_TILES: | ||
| 383 | case ID_COMBOS: | ||
| 384 | case ID_CSETS: | ||
| 385 | case ID_MAPS: | ||
| 386 | case ID_DMAPS: | ||
| 387 | case ID_DOORS: | ||
| 388 | case ID_ITEMS: | ||
| 389 | case ID_WEAPONS: | ||
| 390 | case ID_COLORS: | ||
| 391 | case ID_ICONS: | ||
| 392 | case ID_INITDATA: | ||
| 393 | case ID_GUYS: | ||
| 394 | case ID_MIDIS: | ||
| 395 | case ID_CHEATS: | ||
| 396 | ✗ | break; | |
| 397 | |||
| 398 | default: | ||
| 399 | ✗ | al_trace("Bad section requested!\n"); | |
| 400 | ✗ | return false; | |
| 401 | break; | ||
| 402 | } | ||
| 403 | |||
| 404 | dword section_size; | ||
| 405 | |||
| 406 | //section id | ||
| 407 | ✗ | if(!p_mgetl(§ion_id_read,f)) | |
| 408 | { | ||
| 409 | ✗ | return false; | |
| 410 | } | ||
| 411 | |||
| 412 | ✗ | while(!pack_feof(f)) | |
| 413 | { | ||
| 414 | ✗ | switch(section_id_read) | |
| 415 | { | ||
| 416 | case ID_RULES: | ||
| 417 | case ID_STRINGS: | ||
| 418 | case ID_MISC: | ||
| 419 | case ID_TILES: | ||
| 420 | case ID_COMBOS: | ||
| 421 | case ID_CSETS: | ||
| 422 | case ID_MAPS: | ||
| 423 | case ID_DMAPS: | ||
| 424 | case ID_DOORS: | ||
| 425 | case ID_ITEMS: | ||
| 426 | case ID_WEAPONS: | ||
| 427 | case ID_COLORS: | ||
| 428 | case ID_ICONS: | ||
| 429 | case ID_INITDATA: | ||
| 430 | case ID_GUYS: | ||
| 431 | case ID_MIDIS: | ||
| 432 | case ID_CHEATS: | ||
| 433 | ✗ | catchup=false; | |
| 434 | ✗ | break; | |
| 435 | |||
| 436 | default: | ||
| 437 | ✗ | break; | |
| 438 | } | ||
| 439 | |||
| 440 | |||
| 441 | ✗ | while(catchup) | |
| 442 | { | ||
| 443 | //section id | ||
| 444 | ✗ | section_id_read=(section_id_read<<8); | |
| 445 | |||
| 446 | ✗ | if(!p_getc(&tempbyte,f)) | |
| 447 | { | ||
| 448 | ✗ | return false; | |
| 449 | } | ||
| 450 | |||
| 451 | ✗ | section_id_read+=tempbyte; | |
| 452 | } | ||
| 453 | |||
| 454 | ✗ | if(section_id_read==section_id_requested) | |
| 455 | { | ||
| 456 | ✗ | return true; | |
| 457 | } | ||
| 458 | else | ||
| 459 | { | ||
| 460 | //section version info | ||
| 461 | ✗ | if(!p_igetw(&dummy,f)) | |
| 462 | { | ||
| 463 | ✗ | return false; | |
| 464 | } | ||
| 465 | |||
| 466 | ✗ | if(!p_igetw(&dummy,f)) | |
| 467 | { | ||
| 468 | ✗ | return false; | |
| 469 | } | ||
| 470 | |||
| 471 | //section size | ||
| 472 | ✗ | if(!p_igetl(§ion_size,f)) | |
| 473 | { | ||
| 474 | ✗ | return false; | |
| 475 | } | ||
| 476 | |||
| 477 | //pack_fseek(f, section_size); | ||
| 478 | ✗ | while(section_size>65535) | |
| 479 | { | ||
| 480 | ✗ | pfread(tempbuf,65535,f); | |
| 481 | ✗ | tempbuf[65535]=0; | |
| 482 | ✗ | section_size-=65535; | |
| 483 | } | ||
| 484 | |||
| 485 | ✗ | if(section_size>0) | |
| 486 | { | ||
| 487 | ✗ | pfread(tempbuf,section_size,f); | |
| 488 | ✗ | tempbuf[section_size]=0; | |
| 489 | ✗ | } | |
| 490 | } | ||
| 491 | |||
| 492 | //section id | ||
| 493 | ✗ | if(!p_mgetl(§ion_id_read,f)) | |
| 494 | { | ||
| 495 | ✗ | return false; | |
| 496 | } | ||
| 497 | } | ||
| 498 | |||
| 499 | ✗ | return false; | |
| 500 | ✗ | } | |
| 501 | |||
| 502 | |||
| 503 | |||
| 504 | |||
| 505 | |||
| 506 | ✗ | bool valid_zqt(PACKFILE *f) | |
| 507 | { | ||
| 508 | |||
| 509 | //word tiles_used; | ||
| 510 | //word combos_used; | ||
| 511 | //open the file | ||
| 512 | //PACKFILE *f = pack_fopen(path, F_READ_PACKED); | ||
| 513 | ✗ | if(!f) | |
| 514 | ✗ | return false; | |
| 515 | |||
| 516 | //for now, everything else is valid | ||
| 517 | ✗ | return true; | |
| 518 | |||
| 519 | /*int16_t version; | ||
| 520 | byte build; | ||
| 521 | |||
| 522 | //read the version and make sure it worked | ||
| 523 | if(!p_igetw(&version,f)) | ||
| 524 | { | ||
| 525 | goto error; | ||
| 526 | } | ||
| 527 | |||
| 528 | //read the build and make sure it worked | ||
| 529 | if(!p_getc(&build,f)) | ||
| 530 | goto error; | ||
| 531 | |||
| 532 | //read the tile info and make sure it worked | ||
| 533 | if(!p_igetw(&tiles_used,f)) | ||
| 534 | { | ||
| 535 | goto error; | ||
| 536 | } | ||
| 537 | |||
| 538 | for (int32_t i=0; i<tiles_used; i++) | ||
| 539 | { | ||
| 540 | if(!pfread(trashbuf,tilesize(tf4Bit),f)) | ||
| 541 | { | ||
| 542 | goto error; | ||
| 543 | } | ||
| 544 | } | ||
| 545 | |||
| 546 | //read the combo info and make sure it worked | ||
| 547 | if(!p_igetw(&combos_used,f)) | ||
| 548 | { | ||
| 549 | goto error; | ||
| 550 | } | ||
| 551 | for (int32_t i=0; i<combos_used; i++) | ||
| 552 | { | ||
| 553 | if(!pfread(trashbuf,sizeof(newcombo),f)) | ||
| 554 | { | ||
| 555 | goto error; | ||
| 556 | } | ||
| 557 | } | ||
| 558 | |||
| 559 | //read the palette info and make sure it worked | ||
| 560 | for (int32_t i=0; i<48; i++) | ||
| 561 | { | ||
| 562 | if(!pfread(trashbuf,newpdTOTAL,f)) | ||
| 563 | { | ||
| 564 | goto error; | ||
| 565 | } | ||
| 566 | } | ||
| 567 | if(!pfread(trashbuf,sizeof(palcycle)*256*3,f)) | ||
| 568 | { | ||
| 569 | goto error; | ||
| 570 | } | ||
| 571 | for (int32_t i=0; i<MAXLEVELS; i++) | ||
| 572 | { | ||
| 573 | if(!pfread(trashbuf,PALNAMESIZE,f)) | ||
| 574 | { | ||
| 575 | goto error; | ||
| 576 | } | ||
| 577 | } | ||
| 578 | |||
| 579 | //read the sprite info and make sure it worked | ||
| 580 | for (int32_t i=0; i<MAXITEMS; i++) | ||
| 581 | { | ||
| 582 | if(!pfread(trashbuf,sizeof(itemdata),f)) | ||
| 583 | { | ||
| 584 | goto error; | ||
| 585 | } | ||
| 586 | } | ||
| 587 | |||
| 588 | for (int32_t i=0; i<MAXWPNS; i++) | ||
| 589 | { | ||
| 590 | if(!pfread(trashbuf,sizeof(wpndata),f)) | ||
| 591 | { | ||
| 592 | goto error; | ||
| 593 | } | ||
| 594 | } | ||
| 595 | |||
| 596 | //read the triforce pieces info and make sure it worked | ||
| 597 | for (int32_t i=0; i<8; ++i) | ||
| 598 | { | ||
| 599 | if(!p_getc(&trashbuf,f)) | ||
| 600 | { | ||
| 601 | goto error; | ||
| 602 | } | ||
| 603 | } | ||
| 604 | |||
| 605 | |||
| 606 | |||
| 607 | //read the game icons info and make sure it worked | ||
| 608 | for (int32_t i=0; i<4; ++i) | ||
| 609 | { | ||
| 610 | if(!p_igetw(&trashbuf,f)) | ||
| 611 | { | ||
| 612 | goto error; | ||
| 613 | } | ||
| 614 | } | ||
| 615 | |||
| 616 | //read the misc colors info and map styles info and make sure it worked | ||
| 617 | if(!pfread(trashbuf,sizeof(zcolors),f)) | ||
| 618 | { | ||
| 619 | goto error; | ||
| 620 | } | ||
| 621 | |||
| 622 | //read the template screens and make sure it worked | ||
| 623 | byte num_maps; | ||
| 624 | if(!p_getc(&num_maps,f)) | ||
| 625 | { | ||
| 626 | goto error; | ||
| 627 | } | ||
| 628 | for (int32_t i=0; i<TEMPLATES; i++) | ||
| 629 | { | ||
| 630 | if(!pfread(trashbuf,sizeof(mapscr),f)) | ||
| 631 | { | ||
| 632 | goto error; | ||
| 633 | } | ||
| 634 | } | ||
| 635 | if (num_maps>1) //dungeon templates | ||
| 636 | { | ||
| 637 | for (int32_t i=0; i<TEMPLATES; i++) | ||
| 638 | { | ||
| 639 | if(!pfread(trashbuf,sizeof(mapscr),f)) | ||
| 640 | { | ||
| 641 | goto error; | ||
| 642 | } | ||
| 643 | } | ||
| 644 | } | ||
| 645 | |||
| 646 | //yay! it worked! close the file and say everything was ok. | ||
| 647 | pack_fclose(f); | ||
| 648 | return true; | ||
| 649 | |||
| 650 | error: | ||
| 651 | pack_fclose(f); | ||
| 652 | return false;*/ | ||
| 653 | ✗ | } | |
| 654 | |||
| 655 | ✗ | bool valid_zqt(const char *filename) | |
| 656 | { | ||
| 657 | ✗ | PACKFILE *f=NULL; | |
| 658 | bool isvalid; | ||
| 659 | int32_t error; | ||
| 660 | ✗ | f=open_quest_file(&error, filename, false); | |
| 661 | |||
| 662 | ✗ | if(!f) | |
| 663 | { | ||
| 664 | // setPackfilePassword(NULL); | ||
| 665 | ✗ | return false; | |
| 666 | } | ||
| 667 | |||
| 668 | ✗ | isvalid=valid_zqt(f); | |
| 669 | |||
| 670 | ✗ | clear_quest_tmpfile(); | |
| 671 | ✗ | pack_fclose(f); | |
| 672 | |||
| 673 | // setPackfilePassword(NULL); | ||
| 674 | ✗ | return isvalid; | |
| 675 | ✗ | } | |
| 676 | |||
| 677 | /* | ||
| 678 | .qst file history | ||
| 679 | |||
| 680 | .qst files have always been compressed using allegro's packfiles. | ||
| 681 | |||
| 682 | At some point, an encoding layer was added. The two layers look like this: | ||
| 683 | |||
| 684 | 1) The top layer is from us. See decode_file_007. | ||
| 685 | [0-24] Preamble "Zelda Classic Quest File" | ||
| 686 | [25-28] Initial decoding seed value. | ||
| 687 | [29-X] Allegro-compressed payload (AKA "packed" file), but XOR'd based on seed value | ||
| 688 | [last 4] Checksum | ||
| 689 | |||
| 690 | 2) The bottom layer is a "compressed packed file" from Allegro 4. The entire payload | ||
| 691 | is XOR'd with a password (datapwd). Once that is undone, the first four bytes are "slh!", | ||
| 692 | followed by a lzss compressed representation of the payload (from allergo' packfile compression). | ||
| 693 | The oldest quests skip the password part. | ||
| 694 | |||
| 695 | Simply, the job of this function is to peel away the top layer. | ||
| 696 | |||
| 697 | With this second layer of encryption, the data isn't any more secure, and adds a significant delay | ||
| 698 | in opening and saving files. There is no version field, so they decryption key is | ||
| 699 | found via trial-by-error (very slow!) | ||
| 700 | |||
| 701 | There are other file types of interest: | ||
| 702 | - .zqt: quest template files, skips top-layer encryption pass | ||
| 703 | - .qsu: "unencoded" (and uncompressed) files; skips encryption and compression (also makes the longtan password moot) | ||
| 704 | - .qu?: same as above. automated backup files | ||
| 705 | - .qb?: same as above. automated backup files | ||
| 706 | - .qt?: compressed and encrypted (or not encrypted, as of May 2023) | ||
| 707 | |||
| 708 | May 2023: .qst files are now saved without the top layer encoding, and no allegro packfile password. The first bytes of these | ||
| 709 | files are now "slh!.AG ZC Enhanced Quest File". | ||
| 710 | The following command will take an existing qst file and upgrade it: `./zquest -unencrypt-qst <input> <output>` | ||
| 711 | */ | ||
| 712 | 800 | PACKFILE *open_quest_file(int32_t *open_error, const char *filename, bool show_progress) | |
| 713 | { | ||
| 714 |
1/2✓ Branch 0 taken 800 times.
✗ Branch 1 not taken.
|
800 | if (show_progress) |
| 715 | { | ||
| 716 | ✗ | box_start(1, "Loading Quest", get_zc_font(font_lfont), font, true); | |
| 717 | ✗ | } | |
| 718 | |||
| 719 | 800 | auto unencrypted_result = try_open_maybe_legacy_encoded_file(filename, ENC_STR, nullptr, QH_NEWIDSTR, QH_IDSTR); | |
| 720 |
2/2✓ Branch 0 taken 318 times.
✓ Branch 1 taken 482 times.
|
800 | if (unencrypted_result.decoded_pf) |
| 721 | 318 | return unencrypted_result.decoded_pf; | |
| 722 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 482 times.
|
482 | if (unencrypted_result.not_found) |
| 723 | { | ||
| 724 | ✗ | *open_error = qe_notfound; | |
| 725 | ✗ | return nullptr; | |
| 726 | } | ||
| 727 | |||
| 728 | // Everything below here is legacy code - recently saved quest files will have | ||
| 729 | // returned by now. | ||
| 730 | // The only replay qst file that is still using this legacy encoding is `link_to_the_zelda.qst`. | ||
| 731 | |||
| 732 | // Note: although this is primarily for loading .qst files, it can also handle all of the | ||
| 733 | // file types mentioned in the comment above. No need to be told if the file being loaded | ||
| 734 | // is encrypted or compressed, we can do some simple and fast checks to determine how to load it. | ||
| 735 | 482 | bool top_layer_compressed = unencrypted_result.top_layer_compressed; | |
| 736 | 482 | bool compressed = unencrypted_result.compressed; | |
| 737 | 482 | bool encrypted = unencrypted_result.encrypted; | |
| 738 | |||
| 739 | char tmpfilename[L_tmpnam]; | ||
| 740 | 482 | temp_name(tmpfilename); | |
| 741 | char percent_done[30]; | ||
| 742 | 482 | int32_t current_method=0; | |
| 743 | |||
| 744 | PACKFILE *f; | ||
| 745 | 482 | const char *passwd= encrypted ? datapwd : ""; | |
| 746 | |||
| 747 | // oldquest flag is set when an unencrypted qst file is suspected. | ||
| 748 | 482 | bool oldquest = false; | |
| 749 | int32_t ret; | ||
| 750 | |||
| 751 |
1/2✓ Branch 0 taken 482 times.
✗ Branch 1 not taken.
|
482 | if(strcmp(filename, "default.qst")!=0) |
| 752 | { | ||
| 753 | 482 | box_out(filename); | |
| 754 | 482 | } | |
| 755 | else | ||
| 756 | { | ||
| 757 | ✗ | box_out("new quest"); // Or whatever | |
| 758 | } | ||
| 759 | 482 | box_out("..."); | |
| 760 | 482 | box_eol(); | |
| 761 | 482 | box_eol(); | |
| 762 | |||
| 763 |
1/2✓ Branch 0 taken 482 times.
✗ Branch 1 not taken.
|
482 | if(encrypted) |
| 764 | { | ||
| 765 | 482 | box_out("Decrypting..."); | |
| 766 | 482 | box_save_x(); | |
| 767 | 482 | ret = decode_file_007(filename, tmpfilename, ENC_STR, ENC_METHOD_MAX-1, top_layer_compressed, passwd); | |
| 768 | |||
| 769 |
2/2✓ Branch 0 taken 419 times.
✓ Branch 1 taken 63 times.
|
482 | if(ret) |
| 770 | { | ||
| 771 |
1/3✓ Branch 0 taken 63 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
|
63 | switch(ret) |
| 772 | { | ||
| 773 | case 1: | ||
| 774 | ✗ | box_out("error."); | |
| 775 | ✗ | box_eol(); | |
| 776 | ✗ | box_end(true); | |
| 777 | ✗ | *open_error=qe_notfound; | |
| 778 | ✗ | return NULL; | |
| 779 | |||
| 780 | case 2: | ||
| 781 | ✗ | box_out("error."); | |
| 782 | ✗ | box_eol(); | |
| 783 | ✗ | box_end(true); | |
| 784 | ✗ | *open_error=qe_internal; | |
| 785 | ✗ | return NULL; | |
| 786 | // be sure not to delete tmpfilename now... | ||
| 787 | } | ||
| 788 | |||
| 789 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 63 times.
|
63 | if(ret==5) //old encryption? |
| 790 | { | ||
| 791 | 63 | current_method++; | |
| 792 | 63 | sprintf(percent_done, "%d%%", (current_method*100)/ENC_METHOD_MAX); | |
| 793 | 63 | box_out(percent_done); | |
| 794 | 63 | box_load_x(); | |
| 795 | 63 | ret = decode_file_007(filename, tmpfilename, ENC_STR, ENC_METHOD_211B9, strstr(filename, ".dat#")!=NULL, passwd); | |
| 796 | 63 | } | |
| 797 | |||
| 798 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 63 times.
|
63 | if(ret==5) //old encryption? |
| 799 | { | ||
| 800 | 63 | current_method++; | |
| 801 | 63 | sprintf(percent_done, "%d%%", (current_method*100)/ENC_METHOD_MAX); | |
| 802 | 63 | box_out(percent_done); | |
| 803 | 63 | box_load_x(); | |
| 804 | 63 | ret = decode_file_007(filename, tmpfilename, ENC_STR, ENC_METHOD_192B185, strstr(filename, ".dat#")!=NULL, passwd); | |
| 805 | 63 | } | |
| 806 | |||
| 807 |
2/2✓ Branch 0 taken 45 times.
✓ Branch 1 taken 18 times.
|
63 | if(ret==5) //old encryption? |
| 808 | { | ||
| 809 | 18 | current_method++; | |
| 810 | 18 | sprintf(percent_done, "%d%%", (current_method*100)/ENC_METHOD_MAX); | |
| 811 | 18 | box_out(percent_done); | |
| 812 | 18 | box_load_x(); | |
| 813 | 18 | ret = decode_file_007(filename, tmpfilename, ENC_STR, ENC_METHOD_192B105, strstr(filename, ".dat#")!=NULL, passwd); | |
| 814 | 18 | } | |
| 815 | |||
| 816 |
2/2✓ Branch 0 taken 51 times.
✓ Branch 1 taken 12 times.
|
63 | if(ret==5) //old encryption? |
| 817 | { | ||
| 818 | 12 | current_method++; | |
| 819 | 12 | sprintf(percent_done, "%d%%", (current_method*100)/ENC_METHOD_MAX); | |
| 820 | 12 | box_out(percent_done); | |
| 821 | 12 | box_load_x(); | |
| 822 | 12 | ret = decode_file_007(filename, tmpfilename, ENC_STR, ENC_METHOD_192B104, strstr(filename, ".dat#")!=NULL, passwd); | |
| 823 | 12 | } | |
| 824 | |||
| 825 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 63 times.
|
63 | if(ret) |
| 826 | { | ||
| 827 | ✗ | oldquest = true; | |
| 828 | ✗ | passwd=""; | |
| 829 | ✗ | } | |
| 830 | 63 | } | |
| 831 | |||
| 832 | 482 | box_out("okay."); | |
| 833 | 482 | box_eol(); | |
| 834 | 482 | } | |
| 835 | else | ||
| 836 | { | ||
| 837 | ✗ | oldquest = true; | |
| 838 | } | ||
| 839 | |||
| 840 | 482 | box_out("Opening..."); | |
| 841 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 482 times.
|
482 | f = pack_fopen_password(oldquest ? filename : tmpfilename, compressed ? F_READ_PACKED : F_READ, passwd); |
| 842 |
1/2✓ Branch 0 taken 482 times.
✗ Branch 1 not taken.
|
482 | if(!f) |
| 843 | { | ||
| 844 | ✗ | if((compressed==1)&&(errno==EDOM)) | |
| 845 | { | ||
| 846 | ✗ | f = pack_fopen_password(oldquest ? filename : tmpfilename, F_READ, passwd); | |
| 847 | ✗ | } | |
| 848 | |||
| 849 | ✗ | if(!f) | |
| 850 | { | ||
| 851 | ✗ | if(!oldquest) | |
| 852 | { | ||
| 853 | ✗ | delete_file(tmpfilename); | |
| 854 | ✗ | } | |
| 855 | ✗ | box_out("error."); | |
| 856 | ✗ | box_eol(); | |
| 857 | ✗ | box_end(true); | |
| 858 | ✗ | *open_error=qe_invalid; | |
| 859 | ✗ | return NULL; | |
| 860 | } | ||
| 861 | ✗ | } | |
| 862 | |||
| 863 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 482 times.
|
482 | if(!oldquest) |
| 864 | { | ||
| 865 | 482 | delete_file(tmpfilename); | |
| 866 | 482 | } | |
| 867 | |||
| 868 | 482 | box_out("okay."); | |
| 869 | 482 | box_eol(); | |
| 870 | |||
| 871 | 482 | return f; | |
| 872 | 800 | } | |
| 873 | |||
| 874 | ✗ | PACKFILE *open_quest_template(zquestheader *Header, const char *filename, bool validate) | |
| 875 | { | ||
| 876 | ✗ | PACKFILE *f=NULL; | |
| 877 | ✗ | int32_t open_error=0; | |
| 878 | |||
| 879 | ✗ | if (Header->templatepath[0] != 0) | |
| 880 | { | ||
| 881 | // TODO: should be safe to remove this, no one seems to use custom quest templates. | ||
| 882 | ✗ | filename=Header->templatepath; | |
| 883 | ✗ | } | |
| 884 | |||
| 885 | ✗ | f=open_quest_file(&open_error, filename, false); | |
| 886 | |||
| 887 | ✗ | if(!f) | |
| 888 | { | ||
| 889 | ✗ | return NULL; | |
| 890 | } | ||
| 891 | |||
| 892 | ✗ | if(validate) | |
| 893 | { | ||
| 894 | ✗ | if(!valid_zqt(f)) | |
| 895 | { | ||
| 896 | ✗ | jwin_alert("Error","Invalid Quest Template",NULL,NULL,"O&K",NULL,'k',0,get_zc_font(font_lfont)); | |
| 897 | ✗ | pack_fclose(f); | |
| 898 | ✗ | clear_quest_tmpfile(); | |
| 899 | ✗ | return NULL; | |
| 900 | } | ||
| 901 | ✗ | } | |
| 902 | |||
| 903 | ✗ | return f; | |
| 904 | ✗ | } | |
| 905 | |||
| 906 | ✗ | static bool init_section(zquestheader *Header, int32_t section_id, miscQdata *Misc, zctune *tunes, bool validate, const char* filename) | |
| 907 | { | ||
| 908 | // The only time the player uses this is to init tiles for some quests 1.90 or older. See readtiles. | ||
| 909 | ✗ | if (get_app_id() == App::zelda) | |
| 910 | ✗ | assert(section_id == ID_TILES); | |
| 911 | |||
| 912 | ✗ | combosread=false; | |
| 913 | ✗ | mapsread=false; | |
| 914 | ✗ | fixffcs=false; | |
| 915 | |||
| 916 | ✗ | switch(section_id) | |
| 917 | { | ||
| 918 | case ID_RULES: | ||
| 919 | case ID_STRINGS: | ||
| 920 | case ID_MISC: | ||
| 921 | case ID_TILES: | ||
| 922 | case ID_COMBOS: | ||
| 923 | case ID_CSETS: | ||
| 924 | case ID_MAPS: | ||
| 925 | case ID_DMAPS: | ||
| 926 | case ID_DOORS: | ||
| 927 | case ID_ITEMS: | ||
| 928 | case ID_WEAPONS: | ||
| 929 | case ID_COLORS: | ||
| 930 | case ID_ICONS: | ||
| 931 | case ID_INITDATA: | ||
| 932 | case ID_GUYS: | ||
| 933 | case ID_MIDIS: | ||
| 934 | case ID_CHEATS: | ||
| 935 | case ID_ITEMDROPSETS: | ||
| 936 | case ID_FAVORITES: | ||
| 937 | ✗ | break; | |
| 938 | |||
| 939 | default: | ||
| 940 | ✗ | return false; | |
| 941 | break; | ||
| 942 | } | ||
| 943 | |||
| 944 | int32_t ret; | ||
| 945 | word version, build; | ||
| 946 | ✗ | PACKFILE *f=NULL; | |
| 947 | |||
| 948 | //why is this here? | ||
| 949 | /* | ||
| 950 | if(colordata==NULL) | ||
| 951 | return false; | ||
| 952 | */ | ||
| 953 | |||
| 954 | //setPackfilePassword(datapwd); | ||
| 955 | ✗ | f=open_quest_template(Header, filename, validate); | |
| 956 | |||
| 957 | ✗ | if(!f) //no file, nothing to delete | |
| 958 | { | ||
| 959 | // setPackfilePassword(NULL); | ||
| 960 | ✗ | return false; | |
| 961 | } | ||
| 962 | |||
| 963 | ✗ | ret=get_version_and_build(f, &version, &build); | |
| 964 | |||
| 965 | ✗ | if(ret||(version==0)) | |
| 966 | { | ||
| 967 | ✗ | pack_fclose(f); | |
| 968 | ✗ | clear_quest_tmpfile(); | |
| 969 | |||
| 970 | // setPackfilePassword(NULL); | ||
| 971 | ✗ | return false; | |
| 972 | } | ||
| 973 | |||
| 974 | ✗ | if(!find_section(f, section_id)) | |
| 975 | { | ||
| 976 | ✗ | al_trace("Can't find section!\n"); | |
| 977 | ✗ | pack_fclose(f); | |
| 978 | ✗ | clear_quest_tmpfile(); | |
| 979 | |||
| 980 | //setPackfilePassword(NULL); | ||
| 981 | ✗ | return false; | |
| 982 | } | ||
| 983 | |||
| 984 | ✗ | switch(section_id) | |
| 985 | { | ||
| 986 | case ID_RULES: | ||
| 987 | //rules | ||
| 988 | ✗ | ret=readrules(f, Header); | |
| 989 | ✗ | break; | |
| 990 | |||
| 991 | case ID_STRINGS: | ||
| 992 | //strings | ||
| 993 | ✗ | ret=readstrings(f, Header); | |
| 994 | ✗ | break; | |
| 995 | |||
| 996 | case ID_MISC: | ||
| 997 | //misc data | ||
| 998 | ✗ | ret=readmisc(f, Header, Misc); | |
| 999 | ✗ | break; | |
| 1000 | |||
| 1001 | case ID_TILES: | ||
| 1002 | //tiles | ||
| 1003 | ✗ | ret=readtiles(f, newtilebuf, Header, version, build, 0, NEWMAXTILES, true); | |
| 1004 | ✗ | break; | |
| 1005 | |||
| 1006 | case ID_COMBOS: | ||
| 1007 | //combos | ||
| 1008 | ✗ | clear_combos(); | |
| 1009 | ✗ | ret=readcombos(f, Header, version, build, 0, MAXCOMBOS); | |
| 1010 | ✗ | combosread=true; | |
| 1011 | ✗ | break; | |
| 1012 | |||
| 1013 | case ID_COMBOALIASES: | ||
| 1014 | //combos | ||
| 1015 | ✗ | ret=readcomboaliases(f, Header, version, build); | |
| 1016 | ✗ | break; | |
| 1017 | |||
| 1018 | case ID_CSETS: | ||
| 1019 | //color data | ||
| 1020 | ✗ | ret=readcolordata(f, Misc, version, build, 0, newerpdTOTAL); | |
| 1021 | ✗ | break; | |
| 1022 | |||
| 1023 | case ID_MAPS: | ||
| 1024 | //maps | ||
| 1025 | ✗ | ret=readmaps(f, Header); | |
| 1026 | ✗ | mapsread=true; | |
| 1027 | ✗ | break; | |
| 1028 | |||
| 1029 | case ID_DMAPS: | ||
| 1030 | //dmaps | ||
| 1031 | ✗ | ret=readdmaps(f, Header, version, build, 0, MAXDMAPS); | |
| 1032 | ✗ | break; | |
| 1033 | |||
| 1034 | case ID_DOORS: | ||
| 1035 | //door combo sets | ||
| 1036 | ✗ | ret=readdoorcombosets(f, Header); | |
| 1037 | ✗ | break; | |
| 1038 | |||
| 1039 | case ID_ITEMS: | ||
| 1040 | //items | ||
| 1041 | ✗ | ret=readitems(f, version, build); | |
| 1042 | ✗ | break; | |
| 1043 | |||
| 1044 | case ID_WEAPONS: | ||
| 1045 | //weapons | ||
| 1046 | ✗ | ret=readweapons(f, Header); | |
| 1047 | ✗ | break; | |
| 1048 | |||
| 1049 | case ID_COLORS: | ||
| 1050 | //misc. colors | ||
| 1051 | ✗ | ret=readmisccolors(f, Header, Misc); | |
| 1052 | ✗ | break; | |
| 1053 | |||
| 1054 | case ID_ICONS: | ||
| 1055 | //game icons | ||
| 1056 | ✗ | ret=readgameicons(f, Header, Misc); | |
| 1057 | ✗ | break; | |
| 1058 | |||
| 1059 | case ID_INITDATA: | ||
| 1060 | //initialization data | ||
| 1061 | ✗ | ret=readinitdata(f, Header); | |
| 1062 | ✗ | break; | |
| 1063 | |||
| 1064 | case ID_GUYS: | ||
| 1065 | //guys | ||
| 1066 | ✗ | ret=readguys(f, Header); | |
| 1067 | ✗ | break; | |
| 1068 | |||
| 1069 | case ID_MIDIS: | ||
| 1070 | //midis | ||
| 1071 | ✗ | ret=readtunes(f, Header, tunes); | |
| 1072 | ✗ | break; | |
| 1073 | |||
| 1074 | case ID_CHEATS: | ||
| 1075 | //cheat codes | ||
| 1076 | ✗ | ret=readcheatcodes(f, Header); | |
| 1077 | ✗ | break; | |
| 1078 | |||
| 1079 | case ID_ITEMDROPSETS: | ||
| 1080 | //item drop sets | ||
| 1081 | // Why is this one commented out? | ||
| 1082 | //ret=readitemdropsets(f, (int32_t)version, (word)build); | ||
| 1083 | ✗ | break; | |
| 1084 | |||
| 1085 | case ID_FAVORITES: | ||
| 1086 | // favorite combos and aliases | ||
| 1087 | ✗ | ret=readfavorites(f, version); | |
| 1088 | ✗ | break; | |
| 1089 | |||
| 1090 | default: | ||
| 1091 | ✗ | ret=-1; | |
| 1092 | ✗ | break; | |
| 1093 | } | ||
| 1094 | |||
| 1095 | ✗ | pack_fclose(f); | |
| 1096 | ✗ | clear_quest_tmpfile(); | |
| 1097 | |||
| 1098 | //setPackfilePassword(NULL); | ||
| 1099 | ✗ | if(!ret) | |
| 1100 | { | ||
| 1101 | ✗ | return true; | |
| 1102 | } | ||
| 1103 | |||
| 1104 | ✗ | return false; | |
| 1105 | ✗ | } | |
| 1106 | |||
| 1107 | ✗ | bool init_tiles_for_190(bool validate, zquestheader *Header) | |
| 1108 | { | ||
| 1109 | ✗ | return init_section(Header, ID_TILES, NULL, NULL, validate, "assets/190_tiles.qst"); | |
| 1110 | } | ||
| 1111 | |||
| 1112 | ✗ | bool init_tiles(bool validate, zquestheader *Header) | |
| 1113 | { | ||
| 1114 | ✗ | return init_section(Header, ID_TILES, NULL, NULL, validate, "modules/classic/default.qst"); | |
| 1115 | } | ||
| 1116 | |||
| 1117 | ✗ | bool init_combos(bool validate, zquestheader *Header) | |
| 1118 | { | ||
| 1119 | ✗ | return init_section(Header, ID_COMBOS, NULL, NULL, validate, "modules/classic/default.qst"); | |
| 1120 | } | ||
| 1121 | |||
| 1122 | ✗ | bool init_colordata(bool validate, zquestheader *Header, miscQdata *Misc) | |
| 1123 | { | ||
| 1124 | ✗ | return init_section(Header, ID_CSETS, Misc, NULL, validate, "modules/classic/default.qst"); | |
| 1125 | } | ||
| 1126 | |||
| 1127 | 800 | void init_spritelists() | |
| 1128 | { | ||
| 1129 |
2/2✓ Branch 0 taken 604 times.
✓ Branch 1 taken 196 times.
|
800 | if(FFCore.quest_format[vZelda] < 0x255) |
| 1130 | { | ||
| 1131 | 604 | guys.setMax(255); | |
| 1132 | 604 | items.setMax(255); | |
| 1133 | 604 | Ewpns.setMax(255); | |
| 1134 | 604 | Lwpns.setMax(255); | |
| 1135 | 604 | chainlinks.setMax(255); | |
| 1136 | 604 | decorations.setMax(255); | |
| 1137 | 604 | particles.setMax(255); | |
| 1138 | 604 | } | |
| 1139 | else | ||
| 1140 | { | ||
| 1141 | 196 | guys.setMax(255); | |
| 1142 | 196 | items.setMax(255); | |
| 1143 | 196 | Ewpns.setMax(255); | |
| 1144 | 196 | Lwpns.setMax(255); | |
| 1145 | 196 | chainlinks.setMax(255); | |
| 1146 | 196 | decorations.setMax(255); | |
| 1147 | 196 | particles.setMax(255*((255*4)+1)); //255 per sprite that can use particles; guys, items, ewpns, lwpns, +HERO | |
| 1148 | } | ||
| 1149 | 800 | } | |
| 1150 | |||
| 1151 | 313 | bool reset_items(bool validate, zquestheader *Header) | |
| 1152 | { | ||
| 1153 | 313 | bool ret = true; | |
| 1154 |
1/2✓ Branch 0 taken 313 times.
✗ Branch 1 not taken.
|
313 | if (get_app_id() == App::zquest) |
| 1155 | ✗ | ret = init_section(Header, ID_ITEMS, NULL, NULL, validate, "modules/classic/default.qst"); | |
| 1156 | |||
| 1157 |
2/2✓ Branch 0 taken 313 times.
✓ Branch 1 taken 80128 times.
|
80441 | for(int32_t i=0; i<MAXITEMS; i++) reset_itemname(i); |
| 1158 | |||
| 1159 | 313 | return ret; | |
| 1160 | } | ||
| 1161 | |||
| 1162 | ✗ | bool reset_guys() | |
| 1163 | { | ||
| 1164 | // The .dat file's guys definitions are always synchronised with defdata.cpp's - even the tile settings. | ||
| 1165 | ✗ | init_guys(V_GUYS); | |
| 1166 | ✗ | return true; | |
| 1167 | } | ||
| 1168 | |||
| 1169 | ✗ | bool reset_wpns(bool validate, zquestheader *Header) | |
| 1170 | { | ||
| 1171 | ✗ | bool ret = true; | |
| 1172 | ✗ | if (get_app_id() == App::zquest) | |
| 1173 | ✗ | ret = init_section(Header, ID_WEAPONS, NULL, NULL, validate, "modules/classic/default.qst"); | |
| 1174 | |||
| 1175 | ✗ | for(int32_t i=0; i<MAXWPNS; i++) | |
| 1176 | ✗ | reset_weaponname(i); | |
| 1177 | |||
| 1178 | ✗ | return ret; | |
| 1179 | } | ||
| 1180 | |||
| 1181 | ✗ | bool reset_mapstyles(bool validate, miscQdata *Misc) | |
| 1182 | { | ||
| 1183 | ✗ | Misc->colors.blueframe_tile = 20044; | |
| 1184 | ✗ | Misc->colors.blueframe_cset = 0; | |
| 1185 | ✗ | Misc->colors.triforce_tile = 23461; | |
| 1186 | ✗ | Misc->colors.triforce_cset = 1; | |
| 1187 | ✗ | Misc->colors.triframe_tile = 18752; | |
| 1188 | ✗ | Misc->colors.triframe_cset = 1; | |
| 1189 | ✗ | Misc->colors.overworld_map_tile = 16990; | |
| 1190 | ✗ | Misc->colors.overworld_map_cset = 2; | |
| 1191 | ✗ | Misc->colors.HCpieces_tile = 21160; | |
| 1192 | ✗ | Misc->colors.HCpieces_cset = 8; | |
| 1193 | ✗ | Misc->colors.dungeon_map_tile = 19651; | |
| 1194 | ✗ | Misc->colors.dungeon_map_cset = 8; | |
| 1195 | ✗ | return true; | |
| 1196 | } | ||
| 1197 | |||
| 1198 | 928776 | int32_t read_weap_data(weapon_data& data, PACKFILE* f) | |
| 1199 | { | ||
| 1200 | word v_weapon_data; | ||
| 1201 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 928776 times.
|
928776 | if(!p_igetw(&v_weapon_data,f)) |
| 1202 | ✗ | return qe_invalid; | |
| 1203 | |||
| 1204 |
1/2✓ Branch 0 taken 928776 times.
✗ Branch 1 not taken.
|
928776 | if (!p_igetw(&(data.flags), f)) |
| 1205 | ✗ | return qe_invalid; | |
| 1206 | |||
| 1207 |
1/2✓ Branch 0 taken 928776 times.
✗ Branch 1 not taken.
|
928776 | if (!p_igetl(&(data.moveflags), f)) |
| 1208 | ✗ | return qe_invalid; | |
| 1209 | |||
| 1210 |
1/2✓ Branch 0 taken 928776 times.
✗ Branch 1 not taken.
|
928776 | if (!p_igetw(&(data.wflags), f)) |
| 1211 | ✗ | return qe_invalid; | |
| 1212 | |||
| 1213 |
2/2✓ Branch 0 taken 4643880 times.
✓ Branch 1 taken 928776 times.
|
5572656 | for (int32_t q = 0; q < WPNSPR_MAX; ++q) |
| 1214 | { | ||
| 1215 |
1/2✓ Branch 0 taken 4643880 times.
✗ Branch 1 not taken.
|
4643880 | if (!p_getc(&(data.burnsprs[q]), f)) |
| 1216 | ✗ | return qe_invalid; | |
| 1217 |
1/2✓ Branch 0 taken 4643880 times.
✗ Branch 1 not taken.
|
4643880 | if (!p_getc(&(data.light_rads[q]), f)) |
| 1218 | ✗ | return qe_invalid; | |
| 1219 | 4643880 | } | |
| 1220 |
1/2✓ Branch 0 taken 928776 times.
✗ Branch 1 not taken.
|
928776 | if (!p_getc(&(data.glow_shape), f)) |
| 1221 | ✗ | return qe_invalid; | |
| 1222 | |||
| 1223 |
1/2✓ Branch 0 taken 928776 times.
✗ Branch 1 not taken.
|
928776 | if (!p_igetl(&(data.override_flags), f)) |
| 1224 | ✗ | return qe_invalid; | |
| 1225 |
1/2✓ Branch 0 taken 928776 times.
✗ Branch 1 not taken.
|
928776 | if (!p_igetl(&(data.tilew), f)) |
| 1226 | ✗ | return qe_invalid; | |
| 1227 |
1/2✓ Branch 0 taken 928776 times.
✗ Branch 1 not taken.
|
928776 | if (!p_igetl(&(data.tileh), f)) |
| 1228 | ✗ | return qe_invalid; | |
| 1229 |
1/2✓ Branch 0 taken 928776 times.
✗ Branch 1 not taken.
|
928776 | if (!p_igetl(&(data.hxsz), f)) |
| 1230 | ✗ | return qe_invalid; | |
| 1231 |
1/2✓ Branch 0 taken 928776 times.
✗ Branch 1 not taken.
|
928776 | if (!p_igetl(&(data.hysz), f)) |
| 1232 | ✗ | return qe_invalid; | |
| 1233 |
1/2✓ Branch 0 taken 928776 times.
✗ Branch 1 not taken.
|
928776 | if (!p_igetl(&(data.hzsz), f)) |
| 1234 | ✗ | return qe_invalid; | |
| 1235 |
1/2✓ Branch 0 taken 928776 times.
✗ Branch 1 not taken.
|
928776 | if (!p_igetl(&(data.hxofs), f)) |
| 1236 | ✗ | return qe_invalid; | |
| 1237 |
1/2✓ Branch 0 taken 928776 times.
✗ Branch 1 not taken.
|
928776 | if (!p_igetl(&(data.hyofs), f)) |
| 1238 | ✗ | return qe_invalid; | |
| 1239 |
1/2✓ Branch 0 taken 928776 times.
✗ Branch 1 not taken.
|
928776 | if (!p_igetl(&(data.xofs), f)) |
| 1240 | ✗ | return qe_invalid; | |
| 1241 |
1/2✓ Branch 0 taken 928776 times.
✗ Branch 1 not taken.
|
928776 | if (!p_igetl(&(data.yofs), f)) |
| 1242 | ✗ | return qe_invalid; | |
| 1243 | |||
| 1244 |
1/2✓ Branch 0 taken 928776 times.
✗ Branch 1 not taken.
|
928776 | if (!p_igetzf(&(data.step), f)) |
| 1245 | ✗ | return qe_invalid; | |
| 1246 | |||
| 1247 |
1/2✓ Branch 0 taken 928776 times.
✗ Branch 1 not taken.
|
928776 | if (!p_getc(&(data.unblockable), f)) |
| 1248 | ✗ | return qe_invalid; | |
| 1249 | |||
| 1250 |
1/2✓ Branch 0 taken 928776 times.
✗ Branch 1 not taken.
|
928776 | if (!p_igetl(&(data.timeout), f)) |
| 1251 | ✗ | return qe_invalid; | |
| 1252 | |||
| 1253 |
1/2✓ Branch 0 taken 928776 times.
✗ Branch 1 not taken.
|
928776 | if (!p_getc(&(data.imitate_weapon), f)) |
| 1254 | ✗ | return qe_invalid; | |
| 1255 |
1/2✓ Branch 0 taken 928776 times.
✗ Branch 1 not taken.
|
928776 | if (!p_getc(&(data.default_defense), f)) |
| 1256 | ✗ | return qe_invalid; | |
| 1257 | |||
| 1258 |
1/2✓ Branch 0 taken 928776 times.
✗ Branch 1 not taken.
|
928776 | if (!p_getc(&(data.lift_level), f)) |
| 1259 | ✗ | return qe_invalid; | |
| 1260 |
1/2✓ Branch 0 taken 928776 times.
✗ Branch 1 not taken.
|
928776 | if (!p_getc(&(data.lift_time), f)) |
| 1261 | ✗ | return qe_invalid; | |
| 1262 |
1/2✓ Branch 0 taken 928776 times.
✗ Branch 1 not taken.
|
928776 | if (!p_igetzf(&(data.lift_height), f)) |
| 1263 | ✗ | return qe_invalid; | |
| 1264 | |||
| 1265 |
1/2✓ Branch 0 taken 928776 times.
✗ Branch 1 not taken.
|
928776 | if(!p_igetw(&(data.script), f)) |
| 1266 | ✗ | return qe_invalid; | |
| 1267 |
2/2✓ Branch 0 taken 7430208 times.
✓ Branch 1 taken 928776 times.
|
8358984 | for(uint q = 0; q < 8; ++q) |
| 1268 |
1/2✓ Branch 0 taken 7430208 times.
✗ Branch 1 not taken.
|
7430208 | if(!p_igetl(&(data.initd[q]), f)) |
| 1269 | ✗ | return qe_invalid; | |
| 1270 |
1/2✓ Branch 0 taken 928776 times.
✗ Branch 1 not taken.
|
928776 | if(!p_igetw(&(data.pierce_count), f)) |
| 1271 | ✗ | return qe_invalid; | |
| 1272 | 928776 | return 0; | |
| 1273 | 928776 | } | |
| 1274 | |||
| 1275 | 371 | int32_t get_qst_buffers() | |
| 1276 | { | ||
| 1277 | 371 | TheMaps.resize(MAPSCRS); | |
| 1278 | 371 | old_combo_pages.resize(MAPSCRS); | |
| 1279 | 371 | map_autolayers.resize(6); | |
| 1280 | |||
| 1281 | 371 | Z_message("OK\n"); | |
| 1282 | |||
| 1283 | // The vast majority of finished quests (and I presume this will be consistent for all time) use < 1000 strings in total. | ||
| 1284 | // (Shoelace's "Hero of Dreams" uses 1415.) | ||
| 1285 | // So let's be a bit generous and allow 4096 initially. | ||
| 1286 | // In the rare event that a quest overshoots this mark, we'll reallocate to the full 65535 later. | ||
| 1287 | // I tested it and it worked without flaw on 6/6/11. - L. | ||
| 1288 | // 2022: bumped from 4096 to 8192 to avoid a bug where the Strings menu shows (None) strings when the list passes | ||
| 1289 | // this threshold. Possibly some bug related to `msglistcache` to being reset? | ||
| 1290 | // See https://discord.com/channels/876899628556091432/992984989073416242 | ||
| 1291 | 371 | msg_strings_size = 8192; | |
| 1292 | |||
| 1293 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 371 times.
|
371 | MsgStrings = new MsgStr[msg_strings_size]; |
| 1294 | |||
| 1295 | //memset(MsgStrings, 0, sizeof(MsgStr)*msg_strings_size); | ||
| 1296 |
2/2✓ Branch 0 taken 3039232 times.
✓ Branch 1 taken 371 times.
|
3039603 | for(auto q = 0; q < msg_strings_size; ++q) |
| 1297 | { | ||
| 1298 | 3039232 | MsgStrings[q].clear(); | |
| 1299 | 3039232 | } | |
| 1300 | |||
| 1301 |
1/2✓ Branch 0 taken 371 times.
✗ Branch 1 not taken.
|
371 | if((DMaps=new dmap[MAXDMAPS])==NULL) |
| 1302 | ✗ | return 0; | |
| 1303 | |||
| 1304 | |||
| 1305 | |||
| 1306 | 371 | combobuf.clear(); | |
| 1307 | 371 | combobuf.resize(MAXCOMBOS); | |
| 1308 | |||
| 1309 | |||
| 1310 |
1/2✓ Branch 0 taken 371 times.
✗ Branch 1 not taken.
|
371 | if((colordata=(byte*)malloc(psTOTAL255))==NULL) |
| 1311 | ✗ | return 0; | |
| 1312 | |||
| 1313 | 371 | free_newtilebuf(); | |
| 1314 |
1/2✓ Branch 0 taken 371 times.
✗ Branch 1 not taken.
|
371 | if((newtilebuf=(tiledata*)malloc(NEWMAXTILES*sizeof(tiledata)))==NULL) |
| 1315 | ✗ | return 0; | |
| 1316 | |||
| 1317 | 371 | memset(newtilebuf, 0, NEWMAXTILES*sizeof(tiledata)); | |
| 1318 | //Z_message("Performed memset on tiles\n"); | ||
| 1319 | 371 | clear_tiles(newtilebuf); | |
| 1320 | //Z_message("Performed clear_tiles()\n"); | ||
| 1321 | |||
| 1322 |
2/2✓ Branch 0 taken 358 times.
✓ Branch 1 taken 13 times.
|
371 | if (get_app_id() == App::zquest) |
| 1323 | { | ||
| 1324 |
1/2✓ Branch 0 taken 13 times.
✗ Branch 1 not taken.
|
13 | if((grabtilebuf=(tiledata*)malloc(NEWMAXTILES*sizeof(tiledata)))==NULL) |
| 1325 | ✗ | return 0; | |
| 1326 | |||
| 1327 | 13 | memset(grabtilebuf, 0, NEWMAXTILES*sizeof(tiledata)); | |
| 1328 | 13 | clear_tiles(grabtilebuf); | |
| 1329 | 13 | } | |
| 1330 | |||
| 1331 |
1/2✓ Branch 0 taken 371 times.
✗ Branch 1 not taken.
|
371 | if((trashbuf=(byte*)malloc(100000))==NULL) |
| 1332 | ✗ | return 0; | |
| 1333 | |||
| 1334 | // Big, ugly band-aid here. Perhaps the most common cause of random crashes | ||
| 1335 | // has been inadvertently accessing itemsbuf[-1]. All such crashes should be | ||
| 1336 | // fixed by ensuring there's actually itemdata there. | ||
| 1337 | // If you change this, be sure to update del_qst_buffers, too. | ||
| 1338 | |||
| 1339 |
1/2✓ Branch 0 taken 371 times.
✗ Branch 1 not taken.
|
371 | if((itemsbuf=(itemdata*)malloc(sizeof(itemdata)*(MAXITEMS+1)))==NULL) |
| 1340 | ✗ | return 0; | |
| 1341 | |||
| 1342 |
2/2✓ Branch 0 taken 95347 times.
✓ Branch 1 taken 371 times.
|
95718 | for(size_t q = 0; q < MAXITEMS+1; ++q) |
| 1343 | 95347 | itemsbuf[q].clear(); | |
| 1344 | 371 | itemsbuf++; | |
| 1345 | |||
| 1346 |
1/2✓ Branch 0 taken 371 times.
✗ Branch 1 not taken.
|
371 | if((wpnsbuf=(wpndata*)malloc(sizeof(wpndata)*MAXWPNS))==NULL) |
| 1347 | ✗ | return 0; | |
| 1348 | |||
| 1349 | 371 | memset(wpnsbuf,0,sizeof(wpndata)*MAXWPNS); | |
| 1350 | |||
| 1351 |
1/2✓ Branch 0 taken 371 times.
✗ Branch 1 not taken.
|
371 | if((guysbuf=(guydata*)malloc(sizeof(guydata)*MAXGUYS))==NULL) |
| 1352 | ✗ | return 0; | |
| 1353 | |||
| 1354 |
2/2✓ Branch 0 taken 189952 times.
✓ Branch 1 taken 371 times.
|
190323 | for(size_t q = 0; q < MAXGUYS; ++q) |
| 1355 | 189952 | guysbuf[q].clear(); | |
| 1356 | |||
| 1357 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 371 times.
|
371 | if((combo_class_buf=(comboclass*)malloc(sizeof(comboclass)*cMAX))==NULL) |
| 1358 | ✗ | return 0; | |
| 1359 | |||
| 1360 | 371 | return 1; | |
| 1361 | 371 | } | |
| 1362 | |||
| 1363 | |||
| 1364 | 695 | void free_newtilebuf() | |
| 1365 | { | ||
| 1366 |
2/2✓ Branch 0 taken 325 times.
✓ Branch 1 taken 370 times.
|
695 | if(newtilebuf) |
| 1367 | { | ||
| 1368 |
2/2✓ Branch 0 taken 69712500 times.
✓ Branch 1 taken 325 times.
|
69712825 | for(int32_t i=0; i<NEWMAXTILES; i++) |
| 1369 |
2/2✓ Branch 0 taken 214500 times.
✓ Branch 1 taken 69498000 times.
|
139210500 | if(newtilebuf[i].data) |
| 1370 | 69498000 | free(newtilebuf[i].data); | |
| 1371 | |||
| 1372 | 325 | free(newtilebuf); | |
| 1373 | 325 | newtilebuf = 0; | |
| 1374 | 325 | } | |
| 1375 | 695 | } | |
| 1376 | |||
| 1377 | 324 | void free_grabtilebuf() | |
| 1378 | { | ||
| 1379 |
2/2✓ Branch 0 taken 313 times.
✓ Branch 1 taken 11 times.
|
324 | if (get_app_id() == App::zquest) |
| 1380 | { | ||
| 1381 |
1/2✓ Branch 0 taken 11 times.
✗ Branch 1 not taken.
|
11 | if(grabtilebuf) |
| 1382 | { | ||
| 1383 |
2/2✓ Branch 0 taken 2359500 times.
✓ Branch 1 taken 11 times.
|
2359511 | for(int32_t i=0; i<NEWMAXTILES; i++) |
| 1384 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2359500 times.
|
2359500 | if(grabtilebuf[i].data) free(grabtilebuf[i].data); |
| 1385 | |||
| 1386 | 11 | free(grabtilebuf); | |
| 1387 | 11 | grabtilebuf = 0; | |
| 1388 | 11 | } | |
| 1389 | 11 | } | |
| 1390 | 324 | } | |
| 1391 | |||
| 1392 | 324 | void del_qst_buffers() | |
| 1393 | { | ||
| 1394 |
2/4✗ Branch 0 not taken.
✓ Branch 1 taken 324 times.
✓ Branch 2 taken 324 times.
✗ Branch 3 not taken.
|
324 | if(MsgStrings) delete[] MsgStrings; |
| 1395 | |||
| 1396 |
2/4✗ Branch 0 not taken.
✓ Branch 1 taken 324 times.
✓ Branch 2 taken 324 times.
✗ Branch 3 not taken.
|
324 | if (DMaps) delete[] DMaps; |
| 1397 | |||
| 1398 | 324 | combobuf.clear(); | |
| 1399 | |||
| 1400 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 324 times.
|
324 | if(colordata) free(colordata); |
| 1401 | |||
| 1402 | 324 | free_newtilebuf(); | |
| 1403 | 324 | free_grabtilebuf(); | |
| 1404 | |||
| 1405 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 324 times.
|
324 | if(trashbuf) free(trashbuf); |
| 1406 | |||
| 1407 | // See get_qst_buffers | ||
| 1408 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 324 times.
|
324 | if(itemsbuf) |
| 1409 | { | ||
| 1410 | 324 | itemsbuf--; | |
| 1411 | 324 | free(itemsbuf); | |
| 1412 | 324 | } | |
| 1413 | |||
| 1414 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 324 times.
|
324 | if(wpnsbuf) free(wpnsbuf); |
| 1415 | |||
| 1416 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 324 times.
|
324 | if(guysbuf) free(guysbuf); |
| 1417 | |||
| 1418 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 324 times.
|
324 | if(combo_class_buf) free(combo_class_buf); |
| 1419 | 324 | } | |
| 1420 | |||
| 1421 | 18 | bool init_palnames() | |
| 1422 | { | ||
| 1423 | // if(palnames==NULL) | ||
| 1424 | // return false; | ||
| 1425 | |||
| 1426 |
2/2✓ Branch 0 taken 9216 times.
✓ Branch 1 taken 18 times.
|
9234 | for(int32_t x=0; x<MAXLEVELS; x++) |
| 1427 | { | ||
| 1428 |
4/4✓ Branch 0 taken 9162 times.
✓ Branch 1 taken 18 times.
✓ Branch 2 taken 18 times.
✓ Branch 3 taken 18 times.
|
9216 | switch(x) |
| 1429 | { | ||
| 1430 | case 0: | ||
| 1431 | 18 | sprintf(palnames[x],"Overworld"); | |
| 1432 | 18 | break; | |
| 1433 | |||
| 1434 | case 10: | ||
| 1435 | 18 | sprintf(palnames[x],"Caves"); | |
| 1436 | 18 | break; | |
| 1437 | |||
| 1438 | case 11: | ||
| 1439 | 18 | sprintf(palnames[x],"Passageways"); | |
| 1440 | 18 | break; | |
| 1441 | |||
| 1442 | default: | ||
| 1443 | 9162 | sprintf(palnames[x],"%c",0); | |
| 1444 | 9162 | break; | |
| 1445 | } | ||
| 1446 | 9216 | } | |
| 1447 | |||
| 1448 | 18 | return true; | |
| 1449 | } | ||
| 1450 | |||
| 1451 | 99498 | static void *read_block(PACKFILE *f, int32_t size, int32_t alloc_size) | |
| 1452 | { | ||
| 1453 | void *p; | ||
| 1454 | |||
| 1455 |
1/2✓ Branch 0 taken 99498 times.
✗ Branch 1 not taken.
|
99498 | p = _AL_MALLOC(MAX(size, alloc_size)); |
| 1456 | |||
| 1457 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 99498 times.
|
99498 | if(!p) |
| 1458 | { | ||
| 1459 | ✗ | return NULL; | |
| 1460 | } | ||
| 1461 | |||
| 1462 |
1/2✓ Branch 0 taken 99498 times.
✗ Branch 1 not taken.
|
99498 | if(!pfread(p,size,f)) |
| 1463 | { | ||
| 1464 | ✗ | _AL_FREE(p); | |
| 1465 | ✗ | return NULL; | |
| 1466 | } | ||
| 1467 | |||
| 1468 |
1/2✓ Branch 0 taken 99498 times.
✗ Branch 1 not taken.
|
99498 | if(pack_ferror(f)) |
| 1469 | { | ||
| 1470 | ✗ | _AL_FREE(p); | |
| 1471 | ✗ | return NULL; | |
| 1472 | } | ||
| 1473 | |||
| 1474 | 99498 | return p; | |
| 1475 | 99498 | } | |
| 1476 | |||
| 1477 | // Only use for reading parts of older quests (Header->zelda_version <= 0x192) | ||
| 1478 | static const byte* legacy_skip_flags; | ||
| 1479 | |||
| 1480 | /* read_midi: | ||
| 1481 | * Reads MIDI data from a datafile (this is not the same thing as the | ||
| 1482 | * standard midi file format). | ||
| 1483 | */ | ||
| 1484 | |||
| 1485 | 10195 | static MIDI *read_midi(PACKFILE *f) | |
| 1486 | { | ||
| 1487 | MIDI *m; | ||
| 1488 | int32_t c; | ||
| 1489 | 10195 | int16_t divisions=0; | |
| 1490 | 10195 | int32_t len=0; | |
| 1491 | |||
| 1492 | 10195 | m = (MIDI*)_AL_MALLOC(sizeof(MIDI)); | |
| 1493 | |||
| 1494 |
1/2✓ Branch 0 taken 10195 times.
✗ Branch 1 not taken.
|
10195 | if(!m) |
| 1495 | { | ||
| 1496 | ✗ | return NULL; | |
| 1497 | } | ||
| 1498 | |||
| 1499 |
2/2✓ Branch 0 taken 326240 times.
✓ Branch 1 taken 10195 times.
|
336435 | for(c=0; c<MIDI_TRACKS; c++) |
| 1500 | { | ||
| 1501 | 326240 | m->track[c].len = 0; | |
| 1502 | 326240 | m->track[c].data = NULL; | |
| 1503 | 326240 | } | |
| 1504 | |||
| 1505 | 10195 | p_mgetw(&divisions,f); | |
| 1506 | 10195 | m->divisions=divisions; | |
| 1507 | |||
| 1508 |
2/2✓ Branch 0 taken 326240 times.
✓ Branch 1 taken 10195 times.
|
336435 | for(c=0; c<MIDI_TRACKS; c++) |
| 1509 | { | ||
| 1510 | 326240 | p_mgetl(&len,f); | |
| 1511 | 326240 | m->track[c].len=len; | |
| 1512 | |||
| 1513 |
2/2✓ Branch 0 taken 226742 times.
✓ Branch 1 taken 99498 times.
|
326240 | if(m->track[c].len > 0) |
| 1514 | { | ||
| 1515 | 99498 | m->track[c].data = (byte*)read_block(f, m->track[c].len, 0); | |
| 1516 | |||
| 1517 |
1/2✓ Branch 0 taken 99498 times.
✗ Branch 1 not taken.
|
99498 | if(!m->track[c].data) |
| 1518 | { | ||
| 1519 | ✗ | destroy_midi(m); | |
| 1520 | ✗ | return NULL; | |
| 1521 | } | ||
| 1522 | 99498 | } | |
| 1523 | 326240 | } | |
| 1524 | |||
| 1525 | LOCK_DATA(m, sizeof(MIDI)); | ||
| 1526 | |||
| 1527 |
2/2✓ Branch 0 taken 326240 times.
✓ Branch 1 taken 10195 times.
|
336435 | for(c=0; c<MIDI_TRACKS; c++) |
| 1528 | { | ||
| 1529 |
2/2✓ Branch 0 taken 99498 times.
✓ Branch 1 taken 226742 times.
|
326240 | if(m->track[c].data) |
| 1530 | { | ||
| 1531 | LOCK_DATA(m->track[c].data, m->track[c].len); | ||
| 1532 | 99498 | } | |
| 1533 | 326240 | } | |
| 1534 | |||
| 1535 | 10195 | return m; | |
| 1536 | 10195 | } | |
| 1537 | |||
| 1538 | ✗ | void clear_combo(int32_t i) | |
| 1539 | { | ||
| 1540 | ✗ | combobuf[i].clear(); | |
| 1541 | ✗ | } | |
| 1542 | |||
| 1543 | ✗ | void clear_combos() | |
| 1544 | { | ||
| 1545 | ✗ | for(int32_t tmpcounter=0; tmpcounter<MAXCOMBOS; tmpcounter++) | |
| 1546 | ✗ | clear_combo(tmpcounter); | |
| 1547 | ✗ | } | |
| 1548 | |||
| 1549 | ✗ | void pack_combos() | |
| 1550 | { | ||
| 1551 | ✗ | int32_t di = 0; | |
| 1552 | |||
| 1553 | ✗ | for(int32_t si=0; si<1024; si+=2) | |
| 1554 | ✗ | combobuf[di++] = combobuf[si]; | |
| 1555 | |||
| 1556 | ✗ | for(; di<1024; di++) | |
| 1557 | ✗ | clear_combo(di); | |
| 1558 | ✗ | } | |
| 1559 | |||
| 1560 | 478 | void reset_tunes(zctune *tune) | |
| 1561 | { | ||
| 1562 |
2/2✓ Branch 0 taken 120456 times.
✓ Branch 1 taken 478 times.
|
120934 | for(int32_t i=0; i<MAXCUSTOMTUNES; i++) |
| 1563 | { | ||
| 1564 | 120456 | tune[i].reset(); | |
| 1565 | 120456 | } | |
| 1566 | 478 | } | |
| 1567 | |||
| 1568 | int32_t doortranslations_u[9][4]= | ||
| 1569 | { | ||
| 1570 | {37,38,53,54}, | ||
| 1571 | {37,38,39,40}, | ||
| 1572 | {37,38,55,56}, | ||
| 1573 | {37,38,39,40}, | ||
| 1574 | {37,38,53,54}, | ||
| 1575 | {37,38,53,54}, | ||
| 1576 | {37,38,53,54}, | ||
| 1577 | {7,8,23,24}, | ||
| 1578 | {7,8,41,42} | ||
| 1579 | }; | ||
| 1580 | |||
| 1581 | int32_t doortranslations_d[9][4]= | ||
| 1582 | { | ||
| 1583 | {117,118,133,134}, | ||
| 1584 | {135,136,133,134}, | ||
| 1585 | {119,120,133,134}, | ||
| 1586 | {135,136,133,134}, | ||
| 1587 | {117,118,133,134}, | ||
| 1588 | {117,118,133,134}, | ||
| 1589 | {117,118,133,134}, | ||
| 1590 | {151,152,167,168}, | ||
| 1591 | {137,138,167,168}, | ||
| 1592 | }; | ||
| 1593 | |||
| 1594 | //enum {dt_pass=0, dt_lock, dt_shut, dt_boss, dt_olck, dt_osht, dt_obos, dt_wall, dt_bomb, dt_walk, dt_max}; | ||
| 1595 | int32_t doortranslations_l[9][6]= | ||
| 1596 | { | ||
| 1597 | {66,67,82,83,98,99}, | ||
| 1598 | {66,68,82,84,98,100}, | ||
| 1599 | {66,69,82,85,98,101}, | ||
| 1600 | {66,68,82,84,98,100}, | ||
| 1601 | {66,67,82,83,98,99}, | ||
| 1602 | {66,67,82,83,98,99}, | ||
| 1603 | {66,67,82,83,98,99}, | ||
| 1604 | {64,65,80,81,96,97}, | ||
| 1605 | {64,65,80,114,96,97}, | ||
| 1606 | }; | ||
| 1607 | |||
| 1608 | int32_t doortranslations_r[9][6]= | ||
| 1609 | { | ||
| 1610 | |||
| 1611 | {76,77,92,93,108,109}, | ||
| 1612 | {75,77,91,93,107,109}, | ||
| 1613 | {74,77,90,93,106,109}, | ||
| 1614 | {75,77,91,93,107,109}, | ||
| 1615 | {76,77,92,93,108,109}, | ||
| 1616 | {76,77,92,93,108,109}, | ||
| 1617 | {76,77,92,93,108,109}, | ||
| 1618 | {78,79,94,95,110,111}, | ||
| 1619 | {78,79,125,95,110,111}, | ||
| 1620 | }; | ||
| 1621 | |||
| 1622 | 858450 | int32_t tdcmbdat(int32_t map, int32_t scr, int32_t pos) | |
| 1623 | { | ||
| 1624 | 858450 | byte old_cpage = old_combo_pages[map*MAPSCRS+scr]; | |
| 1625 | 858450 | return (TheMaps[map*MAPSCRS+TEMPLATE].data[pos]&0xFF) + (old_cpage<<8); | |
| 1626 | } | ||
| 1627 | |||
| 1628 | 840750 | int32_t tdcmbcset(int32_t map, int32_t scr, int32_t pos) | |
| 1629 | { | ||
| 1630 | //these are here to bypass compiler warnings about unused arguments | ||
| 1631 | 840750 | map=map; | |
| 1632 | 840750 | scr=scr; | |
| 1633 | 840750 | pos=pos; | |
| 1634 | |||
| 1635 | //what does this function do? | ||
| 1636 | // return TheMaps[map*MAPSCRS+TEMPLATE].cset[pos]; | ||
| 1637 | 840750 | return 2; | |
| 1638 | } | ||
| 1639 | |||
| 1640 | 22848 | int32_t MakeDoors(int32_t map, int32_t scr) | |
| 1641 | { | ||
| 1642 |
2/2✓ Branch 0 taken 18423 times.
✓ Branch 1 taken 4425 times.
|
22848 | if(!(TheMaps[map*MAPSCRS+scr].valid&mVALID)) |
| 1643 | { | ||
| 1644 | 18423 | return 0; | |
| 1645 | } | ||
| 1646 | |||
| 1647 | 4425 | DoorComboSet tempdcs{}; | |
| 1648 | |||
| 1649 | //up | ||
| 1650 |
2/2✓ Branch 0 taken 39825 times.
✓ Branch 1 taken 4425 times.
|
44250 | for(int32_t i=0; i<9; i++) |
| 1651 | { | ||
| 1652 |
2/2✓ Branch 0 taken 159300 times.
✓ Branch 1 taken 39825 times.
|
199125 | for(int32_t j=0; j<4; j++) |
| 1653 | { | ||
| 1654 | 159300 | tempdcs.doorcombo_u[i][j]=tdcmbdat(map,scr,doortranslations_u[i][j]); | |
| 1655 | 159300 | tempdcs.doorcset_u[i][j]=tdcmbcset(map,scr,doortranslations_u[i][j]); | |
| 1656 | 159300 | } | |
| 1657 | 39825 | } | |
| 1658 | |||
| 1659 | 4425 | tempdcs.bombdoorcombo_u[0]=tdcmbdat(map,scr,57); | |
| 1660 | 4425 | tempdcs.bombdoorcset_u[0]=tdcmbcset(map,scr,57); | |
| 1661 | 4425 | tempdcs.bombdoorcombo_u[1]=tdcmbdat(map,scr,58); | |
| 1662 | 4425 | tempdcs.bombdoorcset_u[1]=tdcmbcset(map,scr,58); | |
| 1663 | 4425 | tempdcs.walkthroughcombo[0]=tdcmbdat(map,scr,34); | |
| 1664 | 4425 | tempdcs.walkthroughcset[0]=tdcmbdat(map,scr,34); | |
| 1665 | |||
| 1666 | //down | ||
| 1667 |
2/2✓ Branch 0 taken 39825 times.
✓ Branch 1 taken 4425 times.
|
44250 | for(int32_t i=0; i<9; i++) |
| 1668 | { | ||
| 1669 |
2/2✓ Branch 0 taken 159300 times.
✓ Branch 1 taken 39825 times.
|
199125 | for(int32_t j=0; j<4; j++) |
| 1670 | { | ||
| 1671 | 159300 | tempdcs.doorcombo_d[i][j]=tdcmbdat(map,scr,doortranslations_d[i][j]); | |
| 1672 | 159300 | tempdcs.doorcset_d[i][j]=tdcmbcset(map,scr,doortranslations_d[i][j]); | |
| 1673 | 159300 | } | |
| 1674 | 39825 | } | |
| 1675 | |||
| 1676 | 4425 | tempdcs.bombdoorcombo_d[0]=tdcmbdat(map,scr,121); | |
| 1677 | |||
| 1678 | 4425 | tempdcs.bombdoorcset_d[0]=tdcmbcset(map,scr,121); | |
| 1679 | 4425 | tempdcs.bombdoorcombo_d[1]=tdcmbdat(map,scr,122); | |
| 1680 | 4425 | tempdcs.bombdoorcset_d[1]=tdcmbcset(map,scr,122); | |
| 1681 | 4425 | tempdcs.walkthroughcombo[1]=tdcmbdat(map,scr,34); | |
| 1682 | 4425 | tempdcs.walkthroughcset[1]=tdcmbdat(map,scr,34); | |
| 1683 | |||
| 1684 | //left | ||
| 1685 | // TheMaps[i*MAPSCRS+j].warpdmap=TheOldMap.warpdmap; | ||
| 1686 |
2/2✓ Branch 0 taken 39825 times.
✓ Branch 1 taken 4425 times.
|
44250 | for(int32_t i=0; i<9; i++) |
| 1687 | { | ||
| 1688 |
2/2✓ Branch 0 taken 238950 times.
✓ Branch 1 taken 39825 times.
|
278775 | for(int32_t j=0; j<6; j++) |
| 1689 | { | ||
| 1690 | 238950 | tempdcs.doorcombo_l[i][j]=tdcmbdat(map,scr,doortranslations_l[i][j]); | |
| 1691 | 238950 | tempdcs.doorcset_l[i][j]=tdcmbcset(map,scr,doortranslations_l[i][j]); | |
| 1692 | 238950 | } | |
| 1693 | 39825 | } | |
| 1694 | |||
| 1695 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4425 times.
|
4425 | for(int32_t j=0; j>6; j++) |
| 1696 | { | ||
| 1697 | ✗ | if((j!=2)&&(j!=3)) | |
| 1698 | { | ||
| 1699 | ✗ | tempdcs.doorcombo_l[dt_bomb][j]=TheMaps[map*MAPSCRS+scr].data[doortranslations_l[dt_bomb][j]]; | |
| 1700 | ✗ | tempdcs.doorcset_l[dt_bomb][j]=TheMaps[map*MAPSCRS+scr].cset[doortranslations_l[dt_bomb][j]]; | |
| 1701 | ✗ | } | |
| 1702 | ✗ | } | |
| 1703 | |||
| 1704 | 4425 | tempdcs.bombdoorcombo_l[0]=0; | |
| 1705 | 4425 | tempdcs.bombdoorcset_l[0]=tdcmbcset(map,scr,115); | |
| 1706 | 4425 | tempdcs.bombdoorcombo_l[1]=tdcmbdat(map,scr,115); | |
| 1707 | 4425 | tempdcs.bombdoorcset_l[1]=tdcmbcset(map,scr,115); | |
| 1708 | 4425 | tempdcs.bombdoorcombo_l[2]=0; | |
| 1709 | 4425 | tempdcs.bombdoorcset_l[2]=tdcmbcset(map,scr,115); | |
| 1710 | 4425 | tempdcs.walkthroughcombo[2]=tdcmbdat(map,scr,34); | |
| 1711 | 4425 | tempdcs.walkthroughcset[2]=tdcmbdat(map,scr,34); | |
| 1712 | |||
| 1713 | //right | ||
| 1714 |
2/2✓ Branch 0 taken 39825 times.
✓ Branch 1 taken 4425 times.
|
44250 | for(int32_t i=0; i<9; i++) |
| 1715 | { | ||
| 1716 |
2/2✓ Branch 0 taken 238950 times.
✓ Branch 1 taken 39825 times.
|
278775 | for(int32_t j=0; j<6; j++) |
| 1717 | { | ||
| 1718 | 238950 | tempdcs.doorcombo_r[i][j]=tdcmbdat(map,scr,doortranslations_r[i][j]); | |
| 1719 | 238950 | tempdcs.doorcset_r[i][j]=tdcmbcset(map,scr,doortranslations_r[i][j]); | |
| 1720 | 238950 | } | |
| 1721 | 39825 | } | |
| 1722 | |||
| 1723 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4425 times.
|
4425 | for(int32_t j=0; j>6; j++) |
| 1724 | { | ||
| 1725 | ✗ | if((j!=2)&&(j!=3)) | |
| 1726 | { | ||
| 1727 | ✗ | tempdcs.doorcombo_r[dt_bomb][j]=TheMaps[map*MAPSCRS+scr].data[doortranslations_r[dt_bomb][j]]; | |
| 1728 | ✗ | tempdcs.doorcset_r[dt_bomb][j]=TheMaps[map*MAPSCRS+scr].cset[doortranslations_r[dt_bomb][j]]; | |
| 1729 | ✗ | } | |
| 1730 | ✗ | } | |
| 1731 | |||
| 1732 | 4425 | tempdcs.bombdoorcombo_r[0]=0; | |
| 1733 | 4425 | tempdcs.bombdoorcset_r[0]=tdcmbcset(map,scr,124); | |
| 1734 | 4425 | tempdcs.bombdoorcombo_r[1]=tdcmbdat(map,scr,124); | |
| 1735 | 4425 | tempdcs.bombdoorcset_r[1]=tdcmbcset(map,scr,124); | |
| 1736 | 4425 | tempdcs.bombdoorcombo_r[2]=0; | |
| 1737 | 4425 | tempdcs.bombdoorcset_r[2]=tdcmbcset(map,scr,124); | |
| 1738 | 4425 | tempdcs.walkthroughcombo[3]=tdcmbdat(map,scr,34); | |
| 1739 | 4425 | tempdcs.walkthroughcset[3]=tdcmbdat(map,scr,34); | |
| 1740 | |||
| 1741 | int32_t k; | ||
| 1742 | |||
| 1743 |
2/2✓ Branch 0 taken 60 times.
✓ Branch 1 taken 10306 times.
|
10366 | for(k=0; k<door_combo_set_count; k++) |
| 1744 | { | ||
| 1745 |
2/2✓ Branch 0 taken 5941 times.
✓ Branch 1 taken 4365 times.
|
10306 | if(DoorComboSets[k]==tempdcs) |
| 1746 | { | ||
| 1747 | 4365 | break; | |
| 1748 | } | ||
| 1749 | 5941 | } | |
| 1750 | |||
| 1751 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4425 times.
|
4425 | if (k >= DoorComboSets.size()) |
| 1752 | { | ||
| 1753 | ✗ | return 0; | |
| 1754 | } | ||
| 1755 | |||
| 1756 |
2/2✓ Branch 0 taken 60 times.
✓ Branch 1 taken 4365 times.
|
4425 | if(k==door_combo_set_count) |
| 1757 | { | ||
| 1758 | 60 | DoorComboSets[k]=tempdcs; | |
| 1759 | 60 | DoorComboSetNames[k] = fmt::format("Door Combo Set {}", k); | |
| 1760 | 60 | ++door_combo_set_count; | |
| 1761 | 60 | } | |
| 1762 | |||
| 1763 | 4425 | return k; | |
| 1764 | /* | ||
| 1765 | doorcombo_u[9][4]; | ||
| 1766 | doorcset_u[9][4]; | ||
| 1767 | doorcombo_d[9][4]; | ||
| 1768 | doorcset_d[9][4]; | ||
| 1769 | doorcombo_l[9][6]; | ||
| 1770 | doorcset_l[9][6]; | ||
| 1771 | doorcombo_r[9][6]; | ||
| 1772 | doorcset_r[9][6]; | ||
| 1773 | bombdoorcombo_u[2]; | ||
| 1774 | bombdoorcset_u[2]; | ||
| 1775 | bombdoorcombo_d[2]; | ||
| 1776 | bombdoorcset_d[2]; | ||
| 1777 | bombdoorcombo_l[3]; | ||
| 1778 | bombdoorcset_l[3]; | ||
| 1779 | bombdoorcombo_r[3]; | ||
| 1780 | bombdoorcset_r[3]; | ||
| 1781 | walkthroughcombo[4]; | ||
| 1782 | walkthroughcset[4]; | ||
| 1783 | */ | ||
| 1784 | 22848 | } | |
| 1785 | |||
| 1786 | 2924544 | INLINE int32_t tcmbdat2(int32_t map, int32_t scr, int32_t pos) | |
| 1787 | { | ||
| 1788 | 2924544 | byte old_cpage = old_combo_pages[map*MAPSCRS+scr]; | |
| 1789 | 2924544 | return (TheMaps[map*MAPSCRS+TEMPLATE2].data[pos]&0xFF) + (old_cpage<<8); | |
| 1790 | } | ||
| 1791 | |||
| 1792 | 2924544 | INLINE int32_t tcmbcset2(int32_t map, int32_t pos) | |
| 1793 | { | ||
| 1794 | |||
| 1795 | 2924544 | return TheMaps[map*MAPSCRS+TEMPLATE2].cset[pos]; | |
| 1796 | } | ||
| 1797 | |||
| 1798 | 2924544 | INLINE int32_t tcmbflag2(int32_t map, int32_t pos) | |
| 1799 | { | ||
| 1800 | 2924544 | return TheMaps[map*MAPSCRS+TEMPLATE2].sflag[pos]; | |
| 1801 | } | ||
| 1802 | |||
| 1803 | |||
| 1804 | 83 | void get_questpwd(char *encrypted_pwd, int16_t pwdkey, char *pwd) | |
| 1805 | { | ||
| 1806 | char temp_pwd[30]; | ||
| 1807 | 83 | memset(temp_pwd,0,30); | |
| 1808 | |||
| 1809 |
2/2✓ Branch 0 taken 75 times.
✓ Branch 1 taken 8 times.
|
83 | if(pwdkey!=0) |
| 1810 | { | ||
| 1811 | 75 | memcpy(temp_pwd,encrypted_pwd,30); | |
| 1812 | 75 | temp_pwd[29]=0; | |
| 1813 | |||
| 1814 |
2/2✓ Branch 0 taken 2250 times.
✓ Branch 1 taken 75 times.
|
2325 | for(int32_t i=0; i<30; i++) |
| 1815 | { | ||
| 1816 | 2250 | temp_pwd[i] -= pwdkey; | |
| 1817 | 2250 | int32_t t=pwdkey>>15; | |
| 1818 | 2250 | pwdkey = (pwdkey<<1)+t; | |
| 1819 | 2250 | } | |
| 1820 | 75 | } | |
| 1821 | |||
| 1822 | 83 | memcpy(pwd,temp_pwd,30); | |
| 1823 | 83 | } | |
| 1824 | |||
| 1825 | |||
| 1826 | 253 | bool devpwd() | |
| 1827 | { | ||
| 1828 | #ifdef _DEBUG | ||
| 1829 | return true; | ||
| 1830 | #endif | ||
| 1831 | #if DEVLEVEL > 3 | ||
| 1832 | return true; | ||
| 1833 | #endif | ||
| 1834 |
1/2✓ Branch 0 taken 253 times.
✗ Branch 1 not taken.
|
253 | return !strcmp(zc_get_config("dev","pwd","",App::zquest), (char*)clavio) || is_ci(); |
| 1835 | } | ||
| 1836 | ✗ | bool check_questpwd(zquestheader *Header, char *pwd) | |
| 1837 | { | ||
| 1838 | ✗ | if(devpwd()) | |
| 1839 | ✗ | return true; | |
| 1840 | ✗ | if((!strcmp(pwd, (char*)clavio))) | |
| 1841 | ✗ | return true; | |
| 1842 | cvs_MD5Context ctx; | ||
| 1843 | uint8_t md5sum[16]; | ||
| 1844 | |||
| 1845 | ✗ | cvs_MD5Init(&ctx); | |
| 1846 | ✗ | cvs_MD5Update(&ctx, (const uint8_t*)pwd, (unsigned)strlen(pwd)); | |
| 1847 | ✗ | cvs_MD5Final(md5sum, &ctx); | |
| 1848 | |||
| 1849 | ✗ | return (memcmp(Header->pwd_hash,md5sum,16)==0); | |
| 1850 | ✗ | } | |
| 1851 | |||
| 1852 | static char const* key_exts[KEYFILE_NUMTY] = {"key", "zcheat", "zpwd"}; | ||
| 1853 | static bool key_hashed[KEYFILE_NUMTY] = {false, true, false}; | ||
| 1854 | static char const* key_namestr[KEYFILE_NUMTY] = {"Master","Cheat","ZPwd"}; | ||
| 1855 | |||
| 1856 | ✗ | static bool check_keyfile(char const* path, char const* ext, bool hashed, char const* typestr, zquestheader* Header) | |
| 1857 | { | ||
| 1858 | char keyfilename[2048]; | ||
| 1859 | ✗ | replace_extension(keyfilename, path, ext, 2047); | |
| 1860 | ✗ | if(!exists(keyfilename)) | |
| 1861 | ✗ | return false; | |
| 1862 | ✗ | bool ret = false; | |
| 1863 | |||
| 1864 | ✗ | char password[QSTPWD_LEN] = {0}, pwd[32] = {0}; | |
| 1865 | ✗ | PACKFILE *fp = pack_fopen_password(keyfilename, F_READ,""); | |
| 1866 | ✗ | char msg[80] = {0}; | |
| 1867 | ✗ | pfread(msg, 80, fp); | |
| 1868 | ✗ | if(strcmp(msg,"ZQuest Auto-Generated Quest Password Key File. DO NOT EDIT!")) | |
| 1869 | { | ||
| 1870 | ✗ | zprint2("Found %s Key File '%s' (invalid header)\n", typestr, keyfilename); | |
| 1871 | ✗ | pack_fclose(fp); | |
| 1872 | ✗ | return false; | |
| 1873 | } | ||
| 1874 | int16_t ver; | ||
| 1875 | byte bld; | ||
| 1876 | ✗ | p_igetw(&ver, fp); | |
| 1877 | ✗ | p_getc(&bld, fp); | |
| 1878 | ✗ | pfread(password, QSTPWD_LEN, fp, true); | |
| 1879 | ✗ | if(hashed) | |
| 1880 | { | ||
| 1881 | ✗ | char unhashed_pw[QSTPWD_LEN] = {0}; | |
| 1882 | |||
| 1883 | ✗ | char hashmap = 'Z'; | |
| 1884 | ✗ | hashmap += 'Q'; | |
| 1885 | ✗ | hashmap += 'U'; | |
| 1886 | ✗ | hashmap += 'E'; | |
| 1887 | ✗ | hashmap += 'S'; | |
| 1888 | ✗ | hashmap += 'T'; | |
| 1889 | |||
| 1890 | ✗ | for ( int32_t q = 0; q < QSTPWD_LEN; ++q ) | |
| 1891 | ✗ | unhashed_pw[q] = password[q] - hashmap; | |
| 1892 | |||
| 1893 | ✗ | ret = check_questpwd(Header, unhashed_pw); | |
| 1894 | ✗ | } | |
| 1895 | ✗ | else ret = check_questpwd(Header, password); | |
| 1896 | ✗ | pack_fclose(fp); | |
| 1897 | ✗ | zprint2("Found %s Key File '%s' (%s access)\n", | |
| 1898 | ✗ | typestr, keyfilename, ret ? "valid" : "invalid"); | |
| 1899 | ✗ | return ret; | |
| 1900 | ✗ | } | |
| 1901 | |||
| 1902 | ✗ | bool check_keyfiles(char const* path, vector<uint> types, zquestheader* Header) | |
| 1903 | { | ||
| 1904 | ✗ | char exedir[PATH_MAX] = {0}; | |
| 1905 | ✗ | extract_name(path, exedir, FILENAMEALL); | |
| 1906 | ✗ | char const* paths[] = {path, exedir}; | |
| 1907 | ✗ | for(uint keyty : types) | |
| 1908 | { | ||
| 1909 | ✗ | if(keyty >= KEYFILE_NUMTY) | |
| 1910 | ✗ | continue; | |
| 1911 | ✗ | for(char const* p : paths) | |
| 1912 | { | ||
| 1913 | ✗ | if(check_keyfile(p, key_exts[keyty], key_hashed[keyty], key_namestr[keyty], Header)) | |
| 1914 | ✗ | return true; | |
| 1915 | } | ||
| 1916 | } | ||
| 1917 | ✗ | return false; | |
| 1918 | ✗ | } | |
| 1919 | |||
| 1920 | 434 | void print_quest_metadata(zquestheader const& tempheader, char const* path, byte qst_num) | |
| 1921 | { | ||
| 1922 | 434 | zprint2("\n"); | |
| 1923 | 434 | zprint2("[QUEST METADATA]\n"); | |
| 1924 |
1/2✓ Branch 0 taken 434 times.
✗ Branch 1 not taken.
|
434 | if(path) |
| 1925 | 434 | zprint2("Path: %s\n", path); | |
| 1926 |
2/2✓ Branch 0 taken 321 times.
✓ Branch 1 taken 113 times.
|
434 | if(tempheader.title[0]) |
| 1927 | 321 | zprint2("Title: %s\n", tempheader.title); | |
| 1928 | 434 | zprint2("ZC Version: %s\n", tempheader.getVerStr()); | |
| 1929 |
2/2✓ Branch 0 taken 181 times.
✓ Branch 1 taken 253 times.
|
434 | if(tempheader.new_version_id_date_day) |
| 1930 | 181 | zprint2("ZC Build Date: %d-%d-%d %s %s\n", tempheader.new_version_id_date_year, tempheader.new_version_id_date_month, tempheader.new_version_id_date_day, tempheader.build_timestamp, tempheader.build_timezone); | |
| 1931 |
2/2✓ Branch 0 taken 246 times.
✓ Branch 1 taken 188 times.
|
434 | if(tempheader.version[0]) |
| 1932 | 246 | zprint2("Qst Version: %s\n", tempheader.version); | |
| 1933 |
2/2✓ Branch 0 taken 321 times.
✓ Branch 1 taken 113 times.
|
434 | if(tempheader.author[0]) |
| 1934 | 321 | zprint2("Author: %s\n", tempheader.author); | |
| 1935 | 434 | zprint2("\n"); | |
| 1936 | 434 | } | |
| 1937 | |||
| 1938 | 812 | int32_t readheader(PACKFILE *f, zquestheader *Header, byte printmetadata) | |
| 1939 | { | ||
| 1940 | int32_t dummy; | ||
| 1941 | 812 | zquestheader tempheader{}; | |
| 1942 |
2/2✓ Branch 0 taken 800 times.
✓ Branch 1 taken 12 times.
|
812 | tempheader.filename = Header->filename; |
| 1943 | char dummybuf[80]; | ||
| 1944 | byte temp_map_count; | ||
| 1945 | byte temp_midi_flags[MIDIFLAGS_SIZE]; | ||
| 1946 | word version; | ||
| 1947 | char temp_pwd[30], temp_pwd2[30]; | ||
| 1948 | int16_t temp_pwdkey; | ||
| 1949 | cvs_MD5Context ctx; | ||
| 1950 | 800 | memset(temp_midi_flags, 0, MIDIFLAGS_SIZE); | |
| 1951 | 800 | memset(FFCore.quest_format, 0, sizeof(FFCore.quest_format)); | |
| 1952 | |||
| 1953 | |||
| 1954 | |||
| 1955 |
2/4✓ Branch 0 taken 800 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 800 times.
|
800 | if(!pfread(tempheader.id_str,sizeof(tempheader.id_str),f)) // first read old header |
| 1956 | { | ||
| 1957 | ✗ | Z_message("Unable to read header string\n"); | |
| 1958 | ✗ | return qe_invalid; | |
| 1959 | } | ||
| 1960 | |||
| 1961 | // check header | ||
| 1962 |
2/2✓ Branch 0 taken 776 times.
✓ Branch 1 taken 24 times.
|
800 | if(strcmp(tempheader.id_str,QH_NEWIDSTR)) |
| 1963 | { | ||
| 1964 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 24 times.
|
24 | if(strcmp(tempheader.id_str,QH_IDSTR)) |
| 1965 | { | ||
| 1966 | ✗ | Z_message("Invalid header string: '%s' (was expecting '%s' or '%s')\n", tempheader.id_str, QH_IDSTR, QH_NEWIDSTR); | |
| 1967 | ✗ | return qe_invalid; | |
| 1968 | } | ||
| 1969 | 24 | } | |
| 1970 | |||
| 1971 | 800 | int32_t templatepath_len=0; | |
| 1972 | |||
| 1973 | 800 | tempheader.external_zinfo = false; | |
| 1974 | 800 | read_zinfo = false; | |
| 1975 |
2/2✓ Branch 0 taken 24 times.
✓ Branch 1 taken 776 times.
|
800 | if(!strcmp(tempheader.id_str,QH_IDSTR)) //pre-1.93 version |
| 1976 | { | ||
| 1977 | byte padding; | ||
| 1978 | |||
| 1979 |
2/4✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 24 times.
✗ Branch 3 not taken.
|
24 | if(!p_getc(&padding,f)) |
| 1980 | { | ||
| 1981 | ✗ | return qe_invalid; | |
| 1982 | } | ||
| 1983 | |||
| 1984 |
2/4✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 24 times.
✗ Branch 3 not taken.
|
24 | if(!p_igetw(&tempheader.zelda_version,f)) |
| 1985 | { | ||
| 1986 | ✗ | return qe_invalid; | |
| 1987 | } | ||
| 1988 | |||
| 1989 | 24 | FFCore.quest_format[vZelda] = tempheader.zelda_version; | |
| 1990 | |||
| 1991 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 24 times.
|
24 | if(tempheader.zelda_version > ZELDA_VERSION) |
| 1992 | { | ||
| 1993 | ✗ | return qe_version; | |
| 1994 | } | ||
| 1995 | |||
| 1996 | 24 | FFCore.quest_format[vZelda] = tempheader.zelda_version; | |
| 1997 | |||
| 1998 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 24 times.
|
24 | if(strcmp(tempheader.id_str,QH_IDSTR)) |
| 1999 | { | ||
| 2000 | ✗ | return qe_invalid; | |
| 2001 | } | ||
| 2002 | |||
| 2003 |
2/4✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 24 times.
✗ Branch 3 not taken.
|
24 | if(bad_version(tempheader.zelda_version)) |
| 2004 | { | ||
| 2005 | ✗ | return qe_obsolete; | |
| 2006 | } | ||
| 2007 | |||
| 2008 |
2/4✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 24 times.
|
24 | if(!p_igetw(&tempheader.internal,f)) |
| 2009 | { | ||
| 2010 | ✗ | return qe_invalid; | |
| 2011 | } | ||
| 2012 | |||
| 2013 |
2/4✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 24 times.
|
24 | if(!p_getc(&tempheader.quest_number,f)) |
| 2014 | { | ||
| 2015 | ✗ | return qe_invalid; | |
| 2016 | } | ||
| 2017 | |||
| 2018 | 24 | FFCore.quest_format[qQuestNumber] = tempheader.quest_number; | |
| 2019 | |||
| 2020 |
2/4✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 24 times.
✗ Branch 3 not taken.
|
24 | if(!pfread(&quest_rules[0],2,f)) |
| 2021 | { | ||
| 2022 | ✗ | return qe_invalid; | |
| 2023 | } | ||
| 2024 | |||
| 2025 |
2/4✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 24 times.
✗ Branch 3 not taken.
|
24 | if(!p_getc(&temp_map_count,f)) |
| 2026 | { | ||
| 2027 | ✗ | return qe_invalid; | |
| 2028 | } | ||
| 2029 | |||
| 2030 | 24 | FFCore.quest_format[qMapCount] = temp_map_count; | |
| 2031 | |||
| 2032 |
2/4✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 24 times.
✗ Branch 3 not taken.
|
24 | if(!p_getc(&tempheader.old_str_count,f)) |
| 2033 | { | ||
| 2034 | ✗ | return qe_invalid; | |
| 2035 | } | ||
| 2036 | |||
| 2037 |
2/4✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 24 times.
|
24 | if(!p_getc(&tempheader.data_flags[ZQ_TILES],f)) |
| 2038 | { | ||
| 2039 | ✗ | return qe_invalid; | |
| 2040 | } | ||
| 2041 | |||
| 2042 |
2/4✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 24 times.
|
24 | if(!pfread(temp_midi_flags,4,f)) |
| 2043 | { | ||
| 2044 | ✗ | return qe_invalid; | |
| 2045 | } | ||
| 2046 | |||
| 2047 |
2/4✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 24 times.
✗ Branch 3 not taken.
|
24 | if(!p_getc(&tempheader.data_flags[ZQ_CHEATS2],f)) |
| 2048 | { | ||
| 2049 | ✗ | return qe_invalid; | |
| 2050 | } | ||
| 2051 | |||
| 2052 |
2/4✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 24 times.
✗ Branch 3 not taken.
|
24 | if(!pfread(dummybuf,14,f)) |
| 2053 | { | ||
| 2054 | ✗ | return qe_invalid; | |
| 2055 | } | ||
| 2056 | |||
| 2057 |
2/4✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 24 times.
✗ Branch 3 not taken.
|
24 | if(!pfread(&quest_rules[2],2,f)) |
| 2058 | { | ||
| 2059 | ✗ | return qe_invalid; | |
| 2060 | } | ||
| 2061 | |||
| 2062 |
2/4✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 24 times.
✗ Branch 3 not taken.
|
24 | if(!p_getc(&dummybuf,f)) |
| 2063 | { | ||
| 2064 | ✗ | return qe_invalid; | |
| 2065 | } | ||
| 2066 | |||
| 2067 |
2/4✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 24 times.
✗ Branch 3 not taken.
|
24 | if(!pfread(tempheader.version,9,f)) |
| 2068 | { | ||
| 2069 | ✗ | return qe_invalid; | |
| 2070 | } | ||
| 2071 | |||
| 2072 |
2/4✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 24 times.
✗ Branch 3 not taken.
|
24 | if(!pfread(tempheader.title,sizeof(tempheader.title),f)) |
| 2073 | { | ||
| 2074 | ✗ | return qe_invalid; | |
| 2075 | } | ||
| 2076 | // These fields are expected to end in null bytes! | ||
| 2077 | 24 | tempheader.title[sizeof(tempheader.title)-1] = 0; | |
| 2078 | |||
| 2079 |
2/4✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 24 times.
✗ Branch 3 not taken.
|
24 | if(!pfread(tempheader.author,sizeof(tempheader.author),f)) |
| 2080 | { | ||
| 2081 | ✗ | return qe_invalid; | |
| 2082 | } | ||
| 2083 | 24 | tempheader.author[sizeof(tempheader.author)-1] = 0; | |
| 2084 | |||
| 2085 |
2/4✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 24 times.
✗ Branch 3 not taken.
|
24 | if(!p_getc(&padding,f)) |
| 2086 | { | ||
| 2087 | ✗ | return qe_invalid; | |
| 2088 | } | ||
| 2089 | |||
| 2090 |
2/4✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 24 times.
✗ Branch 3 not taken.
|
24 | if(!p_igetw(&temp_pwdkey,f)) |
| 2091 | { | ||
| 2092 | ✗ | return qe_invalid; | |
| 2093 | } | ||
| 2094 | |||
| 2095 |
2/4✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 24 times.
✗ Branch 3 not taken.
|
24 | if(!pfread(temp_pwd,30,f)) |
| 2096 | { | ||
| 2097 | ✗ | return qe_invalid; | |
| 2098 | } | ||
| 2099 | |||
| 2100 | 24 | get_questpwd(temp_pwd, temp_pwdkey, temp_pwd2); | |
| 2101 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
24 | cvs_MD5Init(&ctx); |
| 2102 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
24 | cvs_MD5Update(&ctx, (const uint8_t*)temp_pwd2, (unsigned)strnlen(temp_pwd2, 30)); |
| 2103 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
24 | cvs_MD5Final(tempheader.pwd_hash, &ctx); |
| 2104 | |||
| 2105 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
24 | if(tempheader.zelda_version < 0x177) // lacks new header stuff... |
| 2106 | { | ||
| 2107 | //memset(tempheader.minver,0,20); // char minver[9], byte build, byte foo[10] | ||
| 2108 | // Not anymore... | ||
| 2109 | ✗ | memset(tempheader.minver,0,17); | |
| 2110 | ✗ | tempheader.build=0; | |
| 2111 | ✗ | tempheader.use_keyfile=0; | |
| 2112 | ✗ | memset(tempheader.old_foo, 0, 9); | |
| 2113 | ✗ | } | |
| 2114 | else | ||
| 2115 | { | ||
| 2116 |
2/4✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 24 times.
✗ Branch 3 not taken.
|
24 | if(!pfread(tempheader.minver,9,f)) |
| 2117 | { | ||
| 2118 | ✗ | return qe_invalid; | |
| 2119 | } | ||
| 2120 | |||
| 2121 |
2/4✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 24 times.
✗ Branch 3 not taken.
|
24 | if(!p_getc(&tempheader.build,f)) |
| 2122 | { | ||
| 2123 | ✗ | return qe_invalid; | |
| 2124 | } | ||
| 2125 | |||
| 2126 | 24 | FFCore.quest_format[vBuild] = tempheader.build; | |
| 2127 | |||
| 2128 |
2/4✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 24 times.
✗ Branch 3 not taken.
|
24 | if(!p_getc(&tempheader.use_keyfile,f)) |
| 2129 | { | ||
| 2130 | ✗ | return qe_invalid; | |
| 2131 | } | ||
| 2132 | |||
| 2133 |
2/4✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 24 times.
✗ Branch 3 not taken.
|
24 | if(!pfread(dummybuf,9,f)) |
| 2134 | { | ||
| 2135 | ✗ | return qe_invalid; | |
| 2136 | } | ||
| 2137 | } // starting at minver | ||
| 2138 | |||
| 2139 |
2/2✓ Branch 0 taken 18 times.
✓ Branch 1 taken 6 times.
|
24 | if(tempheader.zelda_version < 0x187) // lacks newer header stuff... |
| 2140 | { | ||
| 2141 | 6 | memset(&quest_rules[4],0,16); // word rules3..rules10 | |
| 2142 | 6 | } | |
| 2143 | else | ||
| 2144 | { | ||
| 2145 |
2/4✓ Branch 0 taken 18 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 18 times.
✗ Branch 3 not taken.
|
18 | if(!pfread(&quest_rules[4],16,f)) // read new header additions |
| 2146 | { | ||
| 2147 | ✗ | return qe_invalid; // starting at rules3 | |
| 2148 | } | ||
| 2149 | |||
| 2150 |
2/2✓ Branch 0 taken 12 times.
✓ Branch 1 taken 6 times.
|
18 | if(tempheader.zelda_version <= 0x190) |
| 2151 | { | ||
| 2152 |
1/2✓ Branch 0 taken 12 times.
✗ Branch 1 not taken.
|
12 | set_qr(qr_MEANPLACEDTRAPS,0); |
| 2153 | 12 | } | |
| 2154 | } | ||
| 2155 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
24 | unpack_qrs(); |
| 2156 | |||
| 2157 |
3/4✓ Branch 0 taken 6 times.
✓ Branch 1 taken 18 times.
✓ Branch 2 taken 6 times.
✗ Branch 3 not taken.
|
30 | if((tempheader.zelda_version < 0x192)|| |
| 2158 |
1/2✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
|
6 | ((tempheader.zelda_version == 0x192)&&(tempheader.build<149))) |
| 2159 | { | ||
| 2160 |
2/2✓ Branch 0 taken 18 times.
✓ Branch 1 taken 6 times.
|
24 | set_qr(qr_BRKNSHLDTILES,(get_qr(qr_BRKBLSHLDS_DEP))); |
| 2161 |
1/2✓ Branch 0 taken 18 times.
✗ Branch 1 not taken.
|
18 | set_bit(deprecated_rules,qr_BRKBLSHLDS_DEP,(get_qr(qr_BRKBLSHLDS_DEP))); |
| 2162 |
1/2✓ Branch 0 taken 18 times.
✗ Branch 1 not taken.
|
18 | set_qr(qr_BRKBLSHLDS_DEP,0); |
| 2163 | 18 | } | |
| 2164 | |||
| 2165 |
2/2✓ Branch 0 taken 6 times.
✓ Branch 1 taken 12 times.
|
18 | if(tempheader.zelda_version >= 0x192) // lacks newer header stuff... |
| 2166 | { | ||
| 2167 | 6 | byte *mf=temp_midi_flags; | |
| 2168 | |||
| 2169 |
3/4✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✓ Branch 3 taken 4 times.
|
6 | if((tempheader.zelda_version == 0x192)&&(tempheader.build<178)) |
| 2170 | { | ||
| 2171 | 4 | mf=(byte*)dummybuf; | |
| 2172 | 4 | } | |
| 2173 | |||
| 2174 |
2/4✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 6 times.
✗ Branch 3 not taken.
|
6 | if(!pfread(mf,32,f)) // read new header additions |
| 2175 | { | ||
| 2176 | ✗ | return qe_invalid; // starting at foo2 | |
| 2177 | } | ||
| 2178 | |||
| 2179 |
2/4✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 6 times.
✗ Branch 3 not taken.
|
6 | if(!pfread(dummybuf,18,f)) // read new header additions |
| 2180 | { | ||
| 2181 | ✗ | return qe_invalid; // starting at foo2 | |
| 2182 | } | ||
| 2183 | 6 | } | |
| 2184 | |||
| 2185 |
2/2✓ Branch 0 taken 6 times.
✓ Branch 1 taken 12 times.
|
24 | if((tempheader.zelda_version < 0x192)|| |
| 2186 |
1/2✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
|
6 | ((tempheader.zelda_version == 0x192)&&(tempheader.build<145))) |
| 2187 | { | ||
| 2188 | 18 | memset(tempheader.templatepath,0,2048); | |
| 2189 | 18 | } | |
| 2190 | else | ||
| 2191 | { | ||
| 2192 | ✗ | if(!pfread(tempheader.templatepath,280,f)) // read templatepath | |
| 2193 | { | ||
| 2194 | ✗ | return qe_invalid; | |
| 2195 | } | ||
| 2196 | } | ||
| 2197 | |||
| 2198 |
3/4✓ Branch 0 taken 6 times.
✓ Branch 1 taken 18 times.
✓ Branch 2 taken 6 times.
✗ Branch 3 not taken.
|
30 | if((tempheader.zelda_version < 0x192)|| |
| 2199 |
1/2✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
|
6 | ((tempheader.zelda_version == 0x192)&&(tempheader.build<186))) |
| 2200 | { | ||
| 2201 | 24 | tempheader.use_keyfile=0; | |
| 2202 | 24 | } | |
| 2203 | 24 | } | |
| 2204 | else | ||
| 2205 | { | ||
| 2206 | //section id | ||
| 2207 |
2/4✓ Branch 0 taken 776 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 776 times.
✗ Branch 3 not taken.
|
776 | if(!p_mgetl(&dummy,f)) |
| 2208 | { | ||
| 2209 | ✗ | return qe_invalid; | |
| 2210 | } | ||
| 2211 | |||
| 2212 | //section version info | ||
| 2213 |
2/4✓ Branch 0 taken 776 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 776 times.
✗ Branch 3 not taken.
|
776 | if(!p_igetw(&version,f)) |
| 2214 | { | ||
| 2215 | ✗ | return qe_invalid; | |
| 2216 | } | ||
| 2217 | |||
| 2218 | 776 | FFCore.quest_format[vHeader] = version; | |
| 2219 | |||
| 2220 |
2/4✓ Branch 0 taken 776 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 776 times.
✗ Branch 3 not taken.
|
776 | if(!p_igetw(&dummy,f)) |
| 2221 | { | ||
| 2222 | ✗ | return qe_invalid; | |
| 2223 | } | ||
| 2224 | |||
| 2225 | //section size | ||
| 2226 |
2/4✓ Branch 0 taken 776 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 776 times.
✗ Branch 3 not taken.
|
776 | if(!p_igetl(&dummy,f)) |
| 2227 | { | ||
| 2228 | ✗ | return qe_invalid; | |
| 2229 | } | ||
| 2230 | |||
| 2231 | //finally... section data | ||
| 2232 |
2/4✓ Branch 0 taken 776 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 776 times.
✗ Branch 3 not taken.
|
776 | if(!p_igetw(&tempheader.zelda_version,f)) |
| 2233 | { | ||
| 2234 | ✗ | return qe_invalid; | |
| 2235 | } | ||
| 2236 | |||
| 2237 | 776 | FFCore.quest_format[vZelda] = tempheader.zelda_version; | |
| 2238 | |||
| 2239 | //do some quick checking... | ||
| 2240 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 776 times.
|
776 | if(tempheader.zelda_version > ZELDA_VERSION) |
| 2241 | { | ||
| 2242 | ✗ | return qe_version; | |
| 2243 | } | ||
| 2244 | |||
| 2245 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 776 times.
|
776 | if(strcmp(tempheader.id_str,QH_NEWIDSTR)) |
| 2246 | { | ||
| 2247 | ✗ | return qe_invalid; | |
| 2248 | } | ||
| 2249 | |||
| 2250 |
2/4✓ Branch 0 taken 776 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 776 times.
|
776 | if(bad_version(tempheader.zelda_version)) |
| 2251 | { | ||
| 2252 | ✗ | return qe_obsolete; | |
| 2253 | } | ||
| 2254 | |||
| 2255 |
2/4✓ Branch 0 taken 776 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 776 times.
✗ Branch 3 not taken.
|
776 | if(!p_getc(&tempheader.build,f)) |
| 2256 | { | ||
| 2257 | ✗ | return qe_invalid; | |
| 2258 | } | ||
| 2259 | |||
| 2260 | 776 | FFCore.quest_format[vBuild] = tempheader.build; | |
| 2261 | |||
| 2262 |
2/2✓ Branch 0 taken 59 times.
✓ Branch 1 taken 717 times.
|
776 | if(version<3) |
| 2263 | { | ||
| 2264 |
2/4✓ Branch 0 taken 59 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 59 times.
✗ Branch 3 not taken.
|
59 | if(!pfread(temp_pwd,30,f)) |
| 2265 | { | ||
| 2266 | ✗ | return qe_invalid; | |
| 2267 | } | ||
| 2268 | |||
| 2269 |
2/4✓ Branch 0 taken 59 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 59 times.
✗ Branch 3 not taken.
|
59 | if(!p_igetw(&temp_pwdkey,f)) |
| 2270 | { | ||
| 2271 | ✗ | return qe_invalid; | |
| 2272 | } | ||
| 2273 | |||
| 2274 | 59 | get_questpwd(temp_pwd, temp_pwdkey, temp_pwd2); | |
| 2275 |
1/2✓ Branch 0 taken 59 times.
✗ Branch 1 not taken.
|
59 | cvs_MD5Init(&ctx); |
| 2276 |
1/2✓ Branch 0 taken 59 times.
✗ Branch 1 not taken.
|
59 | cvs_MD5Update(&ctx, (const uint8_t*)temp_pwd2, (unsigned)strnlen(temp_pwd2, 30)); |
| 2277 |
1/2✓ Branch 0 taken 59 times.
✗ Branch 1 not taken.
|
59 | cvs_MD5Final(tempheader.pwd_hash, &ctx); |
| 2278 | 59 | } | |
| 2279 | else | ||
| 2280 | { | ||
| 2281 |
2/4✓ Branch 0 taken 717 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 717 times.
|
717 | if(!pfread(tempheader.pwd_hash,sizeof(tempheader.pwd_hash),f)) |
| 2282 | { | ||
| 2283 | ✗ | return qe_invalid; | |
| 2284 | } | ||
| 2285 | } | ||
| 2286 | |||
| 2287 |
2/4✓ Branch 0 taken 776 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 776 times.
✗ Branch 3 not taken.
|
776 | if(!p_igetw(&tempheader.internal,f)) |
| 2288 | { | ||
| 2289 | ✗ | return qe_invalid; | |
| 2290 | } | ||
| 2291 | |||
| 2292 |
2/4✓ Branch 0 taken 776 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 776 times.
✗ Branch 3 not taken.
|
776 | if(!p_getc(&tempheader.quest_number,f)) |
| 2293 | { | ||
| 2294 | ✗ | return qe_invalid; | |
| 2295 | } | ||
| 2296 | |||
| 2297 | 776 | FFCore.quest_format[qQuestNumber] = tempheader.quest_number; | |
| 2298 | |||
| 2299 | 776 | size_t versz = version < 8 ? 9 : 16; | |
| 2300 |
2/4✓ Branch 0 taken 776 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 776 times.
✗ Branch 3 not taken.
|
776 | if(!pfread(tempheader.version,versz,f)) |
| 2301 | { | ||
| 2302 | ✗ | return qe_invalid; | |
| 2303 | } | ||
| 2304 | |||
| 2305 | //FFCore.quest_format[qQuestVersion] = tempheader.version; | ||
| 2306 | //needs to be copied as char[9] or stored as a s.str | ||
| 2307 |
2/4✓ Branch 0 taken 776 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 776 times.
✗ Branch 3 not taken.
|
776 | if(!pfread(tempheader.minver,versz,f)) |
| 2308 | { | ||
| 2309 | ✗ | return qe_invalid; | |
| 2310 | } | ||
| 2311 | |||
| 2312 | //FFCore.quest_format[qMinQuestVersion] = tempheader.minver; | ||
| 2313 |
2/4✓ Branch 0 taken 776 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 776 times.
✗ Branch 3 not taken.
|
776 | if(!pfread(tempheader.title,sizeof(tempheader.title),f)) |
| 2314 | { | ||
| 2315 | ✗ | return qe_invalid; | |
| 2316 | } | ||
| 2317 | 776 | tempheader.title[sizeof(tempheader.title)-1] = 0; | |
| 2318 | |||
| 2319 |
2/4✓ Branch 0 taken 776 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 776 times.
✗ Branch 3 not taken.
|
776 | if(!pfread(tempheader.author,sizeof(tempheader.author),f)) |
| 2320 | { | ||
| 2321 | ✗ | return qe_invalid; | |
| 2322 | } | ||
| 2323 | 776 | tempheader.author[sizeof(tempheader.author)-1] = 0; | |
| 2324 | |||
| 2325 |
2/4✓ Branch 0 taken 776 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 776 times.
✗ Branch 3 not taken.
|
776 | if(!p_getc(&tempheader.use_keyfile,f)) |
| 2326 | { | ||
| 2327 | ✗ | return qe_invalid; | |
| 2328 | } | ||
| 2329 | |||
| 2330 | /* | ||
| 2331 | if(!pfread(tempheader.data_flags,sizeof(tempheader.data_flags),f)) | ||
| 2332 | { | ||
| 2333 | return qe_invalid; | ||
| 2334 | } | ||
| 2335 | */ | ||
| 2336 |
2/4✓ Branch 0 taken 776 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 776 times.
✗ Branch 3 not taken.
|
776 | if(!p_getc(&tempheader.data_flags[ZQ_TILES],f)) |
| 2337 | { | ||
| 2338 | ✗ | return qe_invalid; | |
| 2339 | } | ||
| 2340 | |||
| 2341 |
2/4✓ Branch 0 taken 776 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 776 times.
✗ Branch 3 not taken.
|
776 | if(!pfread(&dummybuf,4,f)) |
| 2342 | { | ||
| 2343 | ✗ | return qe_invalid; | |
| 2344 | } | ||
| 2345 | |||
| 2346 |
2/4✓ Branch 0 taken 776 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 776 times.
✗ Branch 3 not taken.
|
776 | if(!p_getc(&tempheader.data_flags[ZQ_CHEATS2],f)) |
| 2347 | { | ||
| 2348 | ✗ | return qe_invalid; | |
| 2349 | } | ||
| 2350 | |||
| 2351 |
2/4✓ Branch 0 taken 776 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 776 times.
✗ Branch 3 not taken.
|
776 | if(!pfread(dummybuf,14,f)) |
| 2352 | { | ||
| 2353 | ✗ | return qe_invalid; | |
| 2354 | } | ||
| 2355 | |||
| 2356 | 776 | templatepath_len=sizeof(tempheader.templatepath); | |
| 2357 | |||
| 2358 |
2/2✓ Branch 0 taken 717 times.
✓ Branch 1 taken 59 times.
|
776 | if(version==1) |
| 2359 | { | ||
| 2360 | 59 | templatepath_len=280; | |
| 2361 | 59 | } | |
| 2362 | |||
| 2363 |
2/4✓ Branch 0 taken 776 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 776 times.
✗ Branch 3 not taken.
|
776 | if(!pfread(tempheader.templatepath,templatepath_len,f)) |
| 2364 | { | ||
| 2365 | ✗ | return qe_invalid; | |
| 2366 | } | ||
| 2367 | |||
| 2368 |
2/4✓ Branch 0 taken 776 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 776 times.
✗ Branch 3 not taken.
|
776 | if(!p_getc(&temp_map_count,f)) |
| 2369 | { | ||
| 2370 | ✗ | return qe_invalid; | |
| 2371 | } | ||
| 2372 | |||
| 2373 |
2/2✓ Branch 0 taken 196 times.
✓ Branch 1 taken 580 times.
|
776 | if(version>=4) |
| 2374 | { | ||
| 2375 |
2/4✓ Branch 0 taken 196 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 196 times.
✗ Branch 3 not taken.
|
196 | if(!p_igetl(&tempheader.version_major,f)) |
| 2376 | { | ||
| 2377 | ✗ | return qe_invalid; | |
| 2378 | } | ||
| 2379 |
2/4✓ Branch 0 taken 196 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 196 times.
✗ Branch 3 not taken.
|
196 | if(!p_igetl(&tempheader.version_minor,f)) |
| 2380 | { | ||
| 2381 | ✗ | return qe_invalid; | |
| 2382 | } | ||
| 2383 |
2/4✓ Branch 0 taken 196 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 196 times.
✗ Branch 3 not taken.
|
196 | if(!p_igetl(&tempheader.version_patch,f)) |
| 2384 | { | ||
| 2385 | ✗ | return qe_invalid; | |
| 2386 | } | ||
| 2387 |
2/4✓ Branch 0 taken 196 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 196 times.
✗ Branch 3 not taken.
|
196 | if(!p_igetl(&tempheader.new_version_id_fourth,f)) |
| 2388 | { | ||
| 2389 | ✗ | return qe_invalid; | |
| 2390 | } | ||
| 2391 |
2/4✓ Branch 0 taken 196 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 196 times.
✗ Branch 3 not taken.
|
196 | if(!p_igetl(&tempheader.new_version_id_alpha,f)) |
| 2392 | { | ||
| 2393 | ✗ | return qe_invalid; | |
| 2394 | } | ||
| 2395 |
2/4✓ Branch 0 taken 196 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 196 times.
✗ Branch 3 not taken.
|
196 | if(!p_igetl(&tempheader.new_version_id_beta,f)) |
| 2396 | { | ||
| 2397 | ✗ | return qe_invalid; | |
| 2398 | } | ||
| 2399 |
2/4✓ Branch 0 taken 196 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 196 times.
✗ Branch 3 not taken.
|
196 | if(!p_igetl(&tempheader.new_version_id_gamma,f)) |
| 2400 | { | ||
| 2401 | ✗ | return qe_invalid; | |
| 2402 | } | ||
| 2403 |
2/4✓ Branch 0 taken 196 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 196 times.
✗ Branch 3 not taken.
|
196 | if(!p_igetl(&tempheader.new_version_id_release,f)) |
| 2404 | { | ||
| 2405 | ✗ | return qe_invalid; | |
| 2406 | } | ||
| 2407 | |||
| 2408 | // 2.55 alpha 86 incorrectly used 56 as the second version component. Fix that here. | ||
| 2409 |
3/6✓ Branch 0 taken 43 times.
✓ Branch 1 taken 153 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 43 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
196 | if (tempheader.version_major == 2 && tempheader.version_minor == 56 && tempheader.new_version_id_alpha == 86) |
| 2410 | ✗ | tempheader.version_minor = 55; | |
| 2411 | |||
| 2412 |
2/4✓ Branch 0 taken 196 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 196 times.
✗ Branch 3 not taken.
|
196 | if(!p_igetw(&tempheader.new_version_id_date_year,f)) |
| 2413 | { | ||
| 2414 | ✗ | return qe_invalid; | |
| 2415 | } | ||
| 2416 |
2/4✓ Branch 0 taken 196 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 196 times.
✗ Branch 3 not taken.
|
196 | if(!p_getc(&tempheader.new_version_id_date_month,f)) |
| 2417 | { | ||
| 2418 | ✗ | return qe_invalid; | |
| 2419 | } | ||
| 2420 |
2/4✓ Branch 0 taken 196 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 196 times.
✗ Branch 3 not taken.
|
196 | if(!p_getc(&tempheader.new_version_id_date_day,f)) |
| 2421 | { | ||
| 2422 | ✗ | return qe_invalid; | |
| 2423 | } | ||
| 2424 |
2/4✓ Branch 0 taken 196 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 196 times.
✗ Branch 3 not taken.
|
196 | if(!p_getc(&tempheader.new_version_id_date_hour,f)) |
| 2425 | { | ||
| 2426 | ✗ | return qe_invalid; | |
| 2427 | } | ||
| 2428 |
2/4✓ Branch 0 taken 196 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 196 times.
✗ Branch 3 not taken.
|
196 | if(!p_getc(&tempheader.new_version_id_date_minute,f)) |
| 2429 | { | ||
| 2430 | ✗ | return qe_invalid; | |
| 2431 | } | ||
| 2432 | |||
| 2433 |
2/4✓ Branch 0 taken 196 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 196 times.
✗ Branch 3 not taken.
|
196 | if(!pfread(tempheader.new_version_devsig,256,f)) |
| 2434 | { | ||
| 2435 | ✗ | return qe_invalid; | |
| 2436 | } | ||
| 2437 |
1/2✓ Branch 0 taken 196 times.
✗ Branch 1 not taken.
|
196 | if(!strcmp(tempheader.new_version_devsig, "Venrob")) |
| 2438 | ✗ | strcpy(tempheader.new_version_devsig, "EmilyV99"); | |
| 2439 |
2/4✓ Branch 0 taken 196 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 196 times.
✗ Branch 3 not taken.
|
196 | if(!pfread(tempheader.new_version_compilername,256,f)) |
| 2440 | { | ||
| 2441 | ✗ | return qe_invalid; | |
| 2442 | } | ||
| 2443 |
2/4✓ Branch 0 taken 196 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 196 times.
✗ Branch 3 not taken.
|
196 | if(!pfread(tempheader.new_version_compilerversion,256,f)) |
| 2444 | { | ||
| 2445 | ✗ | return qe_invalid; | |
| 2446 | } | ||
| 2447 |
2/4✓ Branch 0 taken 196 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 196 times.
✗ Branch 3 not taken.
|
196 | if(!pfread(tempheader.product_name,1024,f)) |
| 2448 | { | ||
| 2449 | ✗ | return qe_invalid; | |
| 2450 | } | ||
| 2451 | |||
| 2452 |
2/4✓ Branch 0 taken 196 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 196 times.
✗ Branch 3 not taken.
|
196 | if(!p_getc(&tempheader.compilerid,f)) |
| 2453 | { | ||
| 2454 | ✗ | return qe_invalid; | |
| 2455 | } | ||
| 2456 |
2/4✓ Branch 0 taken 196 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 196 times.
✗ Branch 3 not taken.
|
196 | if(!p_igetl(&tempheader.compilerversionnumber_first,f)) |
| 2457 | { | ||
| 2458 | ✗ | return qe_invalid; | |
| 2459 | } | ||
| 2460 |
2/4✓ Branch 0 taken 196 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 196 times.
✗ Branch 3 not taken.
|
196 | if(!p_igetl(&tempheader.compilerversionnumber_second,f)) |
| 2461 | { | ||
| 2462 | ✗ | return qe_invalid; | |
| 2463 | } | ||
| 2464 |
2/4✓ Branch 0 taken 196 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 196 times.
✗ Branch 3 not taken.
|
196 | if(!p_igetl(&tempheader.compilerversionnumber_third,f)) |
| 2465 | { | ||
| 2466 | ✗ | return qe_invalid; | |
| 2467 | } | ||
| 2468 |
2/4✓ Branch 0 taken 196 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 196 times.
✗ Branch 3 not taken.
|
196 | if(!p_igetl(&tempheader.compilerversionnumber_fourth,f)) |
| 2469 | { | ||
| 2470 | ✗ | return qe_invalid; | |
| 2471 | } | ||
| 2472 |
2/4✓ Branch 0 taken 196 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 196 times.
✗ Branch 3 not taken.
|
196 | if(!p_igetw(&tempheader.developerid,f)) |
| 2473 | { | ||
| 2474 | ✗ | return qe_invalid; | |
| 2475 | } | ||
| 2476 |
2/4✓ Branch 0 taken 196 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 196 times.
|
196 | if(!pfread(tempheader.made_in_module_name,1024,f)) |
| 2477 | { | ||
| 2478 | ✗ | return qe_invalid; | |
| 2479 | } | ||
| 2480 |
2/4✓ Branch 0 taken 196 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 196 times.
|
196 | if(!pfread(tempheader.build_datestamp,256,f)) |
| 2481 | { | ||
| 2482 | ✗ | return qe_invalid; | |
| 2483 | } | ||
| 2484 |
2/4✓ Branch 0 taken 196 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 196 times.
|
196 | if(!pfread(tempheader.build_timestamp,256,f)) |
| 2485 | { | ||
| 2486 | ✗ | return qe_invalid; | |
| 2487 | } | ||
| 2488 | 196 | } | |
| 2489 | else // <4 | ||
| 2490 | { | ||
| 2491 | 580 | tempheader.version_major = 0; | |
| 2492 | 580 | tempheader.version_minor = 0; | |
| 2493 | 580 | tempheader.version_patch = 0; | |
| 2494 | 580 | tempheader.new_version_id_fourth = 0; | |
| 2495 | 580 | tempheader.new_version_id_alpha = 0; | |
| 2496 | 580 | tempheader.new_version_id_beta = 0; | |
| 2497 | 580 | tempheader.new_version_id_gamma = 0; | |
| 2498 | 580 | tempheader.new_version_id_release = 0; | |
| 2499 | 580 | tempheader.new_version_id_date_year = 0; | |
| 2500 | 580 | tempheader.new_version_id_date_month = 0; | |
| 2501 | 580 | tempheader.new_version_id_date_day = 0; | |
| 2502 | 580 | tempheader.new_version_id_date_hour = 0; | |
| 2503 | 580 | tempheader.new_version_id_date_minute = 0; | |
| 2504 | |||
| 2505 | 580 | memset(tempheader.new_version_devsig, 0, 256); | |
| 2506 | 580 | memset(tempheader.new_version_compilername, 0, 256); | |
| 2507 | 580 | memset(tempheader.new_version_compilerversion, 0, 256); | |
| 2508 | 580 | memset(tempheader.product_name, 0, 1024); | |
| 2509 | 580 | strcpy(tempheader.product_name, "ZQuest Classic"); | |
| 2510 | |||
| 2511 | 580 | tempheader.compilerid = 0; | |
| 2512 | 580 | tempheader.compilerversionnumber_first = 0; | |
| 2513 | 580 | tempheader.compilerversionnumber_second = 0; | |
| 2514 | 580 | tempheader.compilerversionnumber_third = 0; | |
| 2515 | 580 | tempheader.compilerversionnumber_fourth = 0; | |
| 2516 | 580 | tempheader.developerid = 0; | |
| 2517 | |||
| 2518 | 580 | memset(tempheader.made_in_module_name, 0, 1024); | |
| 2519 | 580 | memset(tempheader.build_datestamp, 0, 256); | |
| 2520 | 580 | memset(tempheader.build_timestamp, 0, 256); | |
| 2521 | } | ||
| 2522 | |||
| 2523 |
2/2✓ Branch 0 taken 196 times.
✓ Branch 1 taken 580 times.
|
776 | if ( version >= 5 ) |
| 2524 | { | ||
| 2525 |
2/4✓ Branch 0 taken 196 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 196 times.
✗ Branch 3 not taken.
|
196 | if(!pfread(tempheader.build_timezone,6,f)) |
| 2526 | { | ||
| 2527 | ✗ | return qe_invalid; | |
| 2528 | } | ||
| 2529 | 196 | } | |
| 2530 | else // < 5 | ||
| 2531 | { | ||
| 2532 | 580 | memset(tempheader.build_timezone, 0, 6); | |
| 2533 | } | ||
| 2534 |
2/2✓ Branch 0 taken 196 times.
✓ Branch 1 taken 580 times.
|
776 | if ( version >= 6 ) |
| 2535 | { | ||
| 2536 | byte b; | ||
| 2537 |
2/4✓ Branch 0 taken 196 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 196 times.
✗ Branch 3 not taken.
|
196 | if(!p_getc(&b,f)) |
| 2538 | { | ||
| 2539 | ✗ | return qe_invalid; | |
| 2540 | } | ||
| 2541 | 196 | tempheader.external_zinfo = b?true:false; | |
| 2542 | 196 | read_zinfo = true; | |
| 2543 | 196 | } | |
| 2544 | |||
| 2545 |
2/2✓ Branch 0 taken 196 times.
✓ Branch 1 taken 580 times.
|
776 | if(version >= 7) |
| 2546 | { | ||
| 2547 |
2/4✓ Branch 0 taken 196 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 196 times.
✗ Branch 3 not taken.
|
196 | if(!p_getc(&(tempheader.new_version_is_nightly),f)) |
| 2548 | { | ||
| 2549 | ✗ | return qe_invalid; | |
| 2550 | } | ||
| 2551 | 196 | } | |
| 2552 | else | ||
| 2553 | { | ||
| 2554 | 580 | tempheader.new_version_is_nightly = false; | |
| 2555 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 580 times.
|
580 | if(tempheader.zelda_version < 0x255) |
| 2556 | { | ||
| 2557 |
2/5✗ Branch 0 not taken.
✗ Branch 1 not taken.
✓ Branch 2 taken 521 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 59 times.
|
580 | switch(tempheader.zelda_version) |
| 2558 | { | ||
| 2559 | case 0x254: | ||
| 2560 | ✗ | tempheader.version_major = 2; | |
| 2561 | ✗ | tempheader.version_minor = 54; | |
| 2562 | ✗ | break; | |
| 2563 | case 0x250: | ||
| 2564 |
7/16✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✓ Branch 6 taken 31 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 24 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 6 times.
✓ Branch 11 taken 402 times.
✗ Branch 12 not taken.
✓ Branch 13 taken 16 times.
✓ Branch 14 taken 29 times.
✓ Branch 15 taken 13 times.
|
521 | switch(tempheader.build) |
| 2565 | { | ||
| 2566 | case 19: | ||
| 2567 | ✗ | tempheader.version_major = 2; | |
| 2568 | ✗ | tempheader.version_minor = 50; | |
| 2569 | ✗ | tempheader.new_version_id_gamma = 1; | |
| 2570 | ✗ | break; | |
| 2571 | case 20: | ||
| 2572 | ✗ | tempheader.version_major = 2; | |
| 2573 | ✗ | tempheader.version_minor = 50; | |
| 2574 | ✗ | tempheader.new_version_id_gamma = 2; | |
| 2575 | ✗ | break; | |
| 2576 | case 21: | ||
| 2577 | ✗ | tempheader.version_major = 2; | |
| 2578 | ✗ | tempheader.version_minor = 50; | |
| 2579 | ✗ | tempheader.new_version_id_gamma = 3; | |
| 2580 | ✗ | break; | |
| 2581 | case 22: | ||
| 2582 | ✗ | tempheader.version_major = 2; | |
| 2583 | ✗ | tempheader.version_minor = 50; | |
| 2584 | ✗ | tempheader.new_version_id_gamma = 4; | |
| 2585 | ✗ | break; | |
| 2586 | case 23: | ||
| 2587 | ✗ | tempheader.version_major = 2; | |
| 2588 | ✗ | tempheader.version_minor = 50; | |
| 2589 | ✗ | tempheader.new_version_id_gamma = 5; | |
| 2590 | ✗ | break; | |
| 2591 | case 24: | ||
| 2592 | 31 | tempheader.version_major = 2; | |
| 2593 | 31 | tempheader.version_minor = 50; | |
| 2594 | 31 | tempheader.new_version_id_release = -1; | |
| 2595 | 31 | break; | |
| 2596 | case 25: | ||
| 2597 | ✗ | tempheader.version_major = 2; | |
| 2598 | ✗ | tempheader.version_minor = 50; | |
| 2599 | ✗ | tempheader.version_patch = 1; | |
| 2600 | ✗ | tempheader.new_version_id_gamma = 1; | |
| 2601 | ✗ | break; | |
| 2602 | case 26: | ||
| 2603 | 24 | tempheader.version_major = 2; | |
| 2604 | 24 | tempheader.version_minor = 50; | |
| 2605 | 24 | tempheader.version_patch = 1; | |
| 2606 | 24 | tempheader.new_version_id_gamma = 2; | |
| 2607 | 24 | break; | |
| 2608 | case 27: | ||
| 2609 | ✗ | tempheader.version_major = 2; | |
| 2610 | ✗ | tempheader.version_minor = 50; | |
| 2611 | ✗ | tempheader.version_patch = 1; | |
| 2612 | ✗ | tempheader.new_version_id_gamma = 3; | |
| 2613 | ✗ | break; | |
| 2614 | case 28: | ||
| 2615 | 6 | tempheader.version_major = 2; | |
| 2616 | 6 | tempheader.version_minor = 50; | |
| 2617 | 6 | tempheader.version_patch = 1; | |
| 2618 | 6 | tempheader.new_version_id_release = -1; | |
| 2619 | 6 | break; | |
| 2620 | case 29: | ||
| 2621 | 402 | tempheader.version_major = 2; | |
| 2622 | 402 | tempheader.version_minor = 50; | |
| 2623 | 402 | tempheader.version_patch = 2; | |
| 2624 | 402 | tempheader.new_version_id_release = -1; | |
| 2625 | 402 | break; | |
| 2626 | case 30: | ||
| 2627 | ✗ | tempheader.version_major = 2; | |
| 2628 | ✗ | tempheader.version_minor = 50; | |
| 2629 | ✗ | tempheader.version_patch = 3; | |
| 2630 | ✗ | tempheader.new_version_id_gamma = 1; | |
| 2631 | ✗ | break; | |
| 2632 | case 31: | ||
| 2633 | 16 | tempheader.version_major = 2; | |
| 2634 | 16 | tempheader.version_minor = 53; | |
| 2635 | 16 | tempheader.new_version_id_gamma = -1; | |
| 2636 | 16 | break; | |
| 2637 | case 32: | ||
| 2638 | 29 | tempheader.version_major = 2; | |
| 2639 | 29 | tempheader.version_minor = 53; | |
| 2640 | 29 | tempheader.new_version_id_release = -1; | |
| 2641 | 29 | break; | |
| 2642 | case 33: | ||
| 2643 | 13 | tempheader.version_major = 2; | |
| 2644 | 13 | tempheader.version_minor = 53; | |
| 2645 | 13 | tempheader.version_patch = 1; | |
| 2646 | 13 | break; | |
| 2647 | } | ||
| 2648 | 521 | break; | |
| 2649 | |||
| 2650 | case 0x211: | ||
| 2651 | ✗ | tempheader.version_major = 2; | |
| 2652 | ✗ | tempheader.version_minor = 11; | |
| 2653 | ✗ | tempheader.new_version_id_beta = tempheader.build; | |
| 2654 | ✗ | break; | |
| 2655 | case 0x210: | ||
| 2656 | 59 | tempheader.version_major = 2; | |
| 2657 | 59 | tempheader.version_minor = 10; | |
| 2658 | 59 | tempheader.new_version_id_beta = tempheader.build; | |
| 2659 | 59 | break; | |
| 2660 | } | ||
| 2661 | 580 | } | |
| 2662 | } | ||
| 2663 | |||
| 2664 |
2/2✓ Branch 0 taken 153 times.
✓ Branch 1 taken 623 times.
|
776 | if (version>=9) |
| 2665 | { | ||
| 2666 | 153 | std::string version_string; | |
| 2667 |
2/4✓ Branch 0 taken 153 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 153 times.
✗ Branch 3 not taken.
|
153 | if(!p_getcstr(&version_string, f)) |
| 2668 | { | ||
| 2669 | ✗ | return qe_invalid; | |
| 2670 | } | ||
| 2671 | |||
| 2672 | 153 | strncpy(tempheader.zelda_version_string, version_string.c_str(), sizeof(tempheader.zelda_version_string)); | |
| 2673 | 153 | snprintf(tempheader.zelda_version_string, sizeof(tempheader.zelda_version_string), "%s", version_string.c_str()); | |
| 2674 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 153 times.
|
153 | } |
| 2675 | else | ||
| 2676 | { | ||
| 2677 | 623 | snprintf(tempheader.zelda_version_string, sizeof(tempheader.zelda_version_string), "%d.%d.%d", tempheader.version_major, tempheader.version_minor, tempheader.version_patch); | |
| 2678 | } | ||
| 2679 | } | ||
| 2680 | |||
| 2681 |
2/2✓ Branch 0 taken 12 times.
✓ Branch 1 taken 788 times.
|
800 | if(printmetadata) |
| 2682 | { | ||
| 2683 |
1/2✓ Branch 0 taken 12 times.
✗ Branch 1 not taken.
|
12 | print_quest_metadata(tempheader, loading_qst_name, loading_qst_num); |
| 2684 | 12 | } | |
| 2685 | |||
| 2686 | //{ Version Warning | ||
| 2687 |
1/2✓ Branch 0 taken 800 times.
✗ Branch 1 not taken.
|
800 | int32_t vercmp = tempheader.compareVer(); |
| 2688 |
3/6✓ Branch 0 taken 800 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 800 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 800 times.
✗ Branch 5 not taken.
|
800 | int32_t astatecmp = compare(int32_t(tempheader.getAlphaState()), getAlphaState()); |
| 2689 |
2/4✓ Branch 0 taken 800 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 800 times.
✗ Branch 3 not taken.
|
800 | int32_t avercmp = compare(tempheader.getAlphaVer(), 0); |
| 2690 |
4/6✓ Branch 0 taken 800 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 153 times.
✓ Branch 3 taken 647 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 153 times.
|
953 | if(vercmp > 0 || (!vercmp && |
| 2691 |
2/4✓ Branch 0 taken 153 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 153 times.
✗ Branch 3 not taken.
|
153 | (astatecmp > 0 || (!astatecmp && |
| 2692 | 153 | avercmp > 0)))) | |
| 2693 | { | ||
| 2694 | ✗ | bool r = true; | |
| 2695 | ✗ | if(loadquest_report) | |
| 2696 | { | ||
| 2697 | ✗ | enter_sys_pal(); | |
| 2698 | ✗ | AlertDialog("Quest saved in newer version", | |
| 2699 | "This quest was last saved in a newer version of ZQuest." | ||
| 2700 | " Attempting to load this quest may not work correctly; to" | ||
| 2701 | ✗ | " avoid issues, try loading this quest in at least '" + std::string(tempheader.getVerStr()) + "'" | |
| 2702 | "\n\nWould you like to continue loading anyway? (Not recommended)", | ||
| 2703 | ✗ | [&](bool ret,bool) | |
| 2704 | { | ||
| 2705 | ✗ | r = ret; | |
| 2706 | ✗ | }).show(); | |
| 2707 | ✗ | exit_sys_pal(); | |
| 2708 | ✗ | } | |
| 2709 | ✗ | if(!r) | |
| 2710 | ✗ | return qe_silenterr; | |
| 2711 | ✗ | } | |
| 2712 |
2/4✓ Branch 0 taken 800 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 800 times.
✗ Branch 3 not taken.
|
800 | else if(tempheader.compareDate() > 0) |
| 2713 | { | ||
| 2714 | ✗ | bool r = true; | |
| 2715 | ✗ | if(loadquest_report) | |
| 2716 | { | ||
| 2717 | ✗ | enter_sys_pal(); | |
| 2718 | ✗ | AlertDialog("Quest saved in newer build", | |
| 2719 | ✗ | fmt::format("This quest was last saved in a newer build of ZQuest, and may have" | |
| 2720 | " issues loading in this build." | ||
| 2721 | "\n{}" | ||
| 2722 | "\n\nWould you like to continue loading anyway?", | ||
| 2723 | ✗ | tempheader.getVerCmpStr()), | |
| 2724 | ✗ | [&](bool ret,bool) | |
| 2725 | { | ||
| 2726 | ✗ | r = ret; | |
| 2727 | ✗ | }).show(); | |
| 2728 | ✗ | exit_sys_pal(); | |
| 2729 | ✗ | } | |
| 2730 | ✗ | if(!r) | |
| 2731 | ✗ | return qe_silenterr; | |
| 2732 | ✗ | } | |
| 2733 | //} | ||
| 2734 | |||
| 2735 | 800 | read_ext_zinfo = tempheader.external_zinfo; | |
| 2736 | |||
| 2737 |
1/2✓ Branch 0 taken 800 times.
✗ Branch 1 not taken.
|
800 | *Header = tempheader; |
| 2738 | 800 | map_count=temp_map_count; | |
| 2739 | 800 | memcpy(midi_flags, temp_midi_flags, MIDIFLAGS_SIZE); | |
| 2740 | |||
| 2741 |
1/2✓ Branch 0 taken 800 times.
✗ Branch 1 not taken.
|
800 | unpack_qrs(); |
| 2742 | |||
| 2743 | 800 | return 0; | |
| 2744 | 824 | } | |
| 2745 | |||
| 2746 | 9696 | int32_t readrules(PACKFILE *f, zquestheader *Header) | |
| 2747 | { | ||
| 2748 |
2/2✓ Branch 0 taken 9673 times.
✓ Branch 1 taken 23 times.
|
9696 | bool should_skip = legacy_skip_flags && get_bit(legacy_skip_flags, skip_rules); |
| 2749 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 9696 times.
|
9696 | if (should_skip) |
| 2750 | ✗ | return 0; | |
| 2751 | |||
| 2752 | int32_t dummy; | ||
| 2753 | 9696 | zquestheader tempheader = *Header; | |
| 2754 | 9696 | word s_version=0; | |
| 2755 | 9696 | dword compatrule_version=0; | |
| 2756 | |||
| 2757 |
2/2✓ Branch 0 taken 455 times.
✓ Branch 1 taken 9241 times.
|
9696 | if(tempheader.zelda_version >= 0x193) |
| 2758 | { | ||
| 2759 | //section version info | ||
| 2760 |
2/4✓ Branch 0 taken 455 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 455 times.
✗ Branch 3 not taken.
|
455 | if(!p_igetw(&s_version,f)) |
| 2761 | { | ||
| 2762 | ✗ | return qe_invalid; | |
| 2763 | } | ||
| 2764 | |||
| 2765 | 455 | FFCore.quest_format[vRules] = s_version; | |
| 2766 | |||
| 2767 |
2/4✓ Branch 0 taken 455 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 455 times.
✗ Branch 3 not taken.
|
455 | if(!p_igetw(&dummy,f)) |
| 2768 | { | ||
| 2769 | ✗ | return qe_invalid; | |
| 2770 | } | ||
| 2771 | |||
| 2772 |
2/2✓ Branch 0 taken 196 times.
✓ Branch 1 taken 259 times.
|
455 | if(s_version > 16) |
| 2773 | { | ||
| 2774 |
2/4✓ Branch 0 taken 196 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 196 times.
✗ Branch 3 not taken.
|
196 | if(!p_igetl(&compatrule_version,f)) |
| 2775 | { | ||
| 2776 | ✗ | return qe_invalid; | |
| 2777 | } | ||
| 2778 | 196 | } | |
| 2779 | 455 | FFCore.quest_format[vCompatRule] = compatrule_version; | |
| 2780 | |||
| 2781 | //section size | ||
| 2782 |
2/4✓ Branch 0 taken 455 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 455 times.
✗ Branch 3 not taken.
|
455 | if(!p_igetl(&dummy,f)) |
| 2783 | { | ||
| 2784 | ✗ | return qe_invalid; | |
| 2785 | } | ||
| 2786 | |||
| 2787 |
2/2✓ Branch 0 taken 259 times.
✓ Branch 1 taken 196 times.
|
455 | if ( s_version < 15 ) |
| 2788 | { | ||
| 2789 | //finally... section data | ||
| 2790 |
2/4✓ Branch 0 taken 259 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 259 times.
✗ Branch 3 not taken.
|
259 | if(!pfread(quest_rules,QUESTRULES_SIZE,f)) |
| 2791 | { | ||
| 2792 | ✗ | return qe_invalid; | |
| 2793 | } | ||
| 2794 | 259 | } | |
| 2795 | else | ||
| 2796 | { | ||
| 2797 | |||
| 2798 |
2/4✓ Branch 0 taken 196 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 196 times.
✗ Branch 3 not taken.
|
196 | if(!pfread(quest_rules,QUESTRULES_NEW_SIZE,f)) |
| 2799 | { | ||
| 2800 | ✗ | return qe_invalid; | |
| 2801 | } | ||
| 2802 | |||
| 2803 | } | ||
| 2804 | 455 | } | |
| 2805 | |||
| 2806 | //{ bunch of compat stuff | ||
| 2807 | 9696 | memcpy(deprecated_rules, quest_rules, QUESTRULES_NEW_SIZE); | |
| 2808 | |||
| 2809 |
2/2✓ Branch 0 taken 478 times.
✓ Branch 1 taken 9218 times.
|
9696 | unpack_qrs(); |
| 2810 | |||
| 2811 |
2/2✓ Branch 0 taken 82 times.
✓ Branch 1 taken 396 times.
|
478 | if(s_version<2) |
| 2812 | { | ||
| 2813 |
1/2✓ Branch 0 taken 82 times.
✗ Branch 1 not taken.
|
82 | set_qr(14,0); |
| 2814 |
1/2✓ Branch 0 taken 82 times.
✗ Branch 1 not taken.
|
82 | set_qr(27,0); |
| 2815 |
1/2✓ Branch 0 taken 82 times.
✗ Branch 1 not taken.
|
82 | set_qr(28,0); |
| 2816 |
1/2✓ Branch 0 taken 82 times.
✗ Branch 1 not taken.
|
82 | set_qr(29,0); |
| 2817 |
1/2✓ Branch 0 taken 82 times.
✗ Branch 1 not taken.
|
82 | set_qr(30,0); |
| 2818 |
1/2✓ Branch 0 taken 82 times.
✗ Branch 1 not taken.
|
82 | set_qr(32,0); |
| 2819 |
1/2✓ Branch 0 taken 82 times.
✗ Branch 1 not taken.
|
82 | set_qr(36,0); |
| 2820 |
1/2✓ Branch 0 taken 82 times.
✗ Branch 1 not taken.
|
82 | set_qr(49,0); |
| 2821 |
1/2✓ Branch 0 taken 82 times.
✗ Branch 1 not taken.
|
82 | set_qr(50,0); |
| 2822 |
1/2✓ Branch 0 taken 82 times.
✗ Branch 1 not taken.
|
82 | set_qr(51,0); |
| 2823 |
1/2✓ Branch 0 taken 82 times.
✗ Branch 1 not taken.
|
82 | set_qr(68,0); |
| 2824 |
1/2✓ Branch 0 taken 82 times.
✗ Branch 1 not taken.
|
82 | set_qr(75,0); |
| 2825 |
1/2✓ Branch 0 taken 82 times.
✗ Branch 1 not taken.
|
82 | set_qr(76,0); |
| 2826 |
1/2✓ Branch 0 taken 82 times.
✗ Branch 1 not taken.
|
82 | set_qr(98,0); |
| 2827 |
1/2✓ Branch 0 taken 82 times.
✗ Branch 1 not taken.
|
82 | set_qr(110,0); |
| 2828 |
1/2✓ Branch 0 taken 82 times.
✗ Branch 1 not taken.
|
82 | set_qr(113,0); |
| 2829 |
1/2✓ Branch 0 taken 82 times.
✗ Branch 1 not taken.
|
82 | set_qr(116,0); |
| 2830 |
1/2✓ Branch 0 taken 82 times.
✗ Branch 1 not taken.
|
82 | set_qr(102,0); |
| 2831 |
1/2✓ Branch 0 taken 82 times.
✗ Branch 1 not taken.
|
82 | set_qr(132,0); |
| 2832 | 82 | } | |
| 2833 | |||
| 2834 | //Now, do any updates... | ||
| 2835 |
3/4✓ Branch 0 taken 396 times.
✓ Branch 1 taken 82 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 396 times.
|
478 | if((tempheader.zelda_version < 0x211)||((tempheader.zelda_version == 0x211)&&(tempheader.build<18))) |
| 2836 | { | ||
| 2837 |
1/2✓ Branch 0 taken 82 times.
✗ Branch 1 not taken.
|
82 | set_qr(qr_SMOOTHVERTICALSCROLLING,1); |
| 2838 |
1/2✓ Branch 0 taken 82 times.
✗ Branch 1 not taken.
|
82 | set_qr(qr_REPLACEOPENDOORS, 1); |
| 2839 |
1/2✓ Branch 0 taken 82 times.
✗ Branch 1 not taken.
|
82 | set_qr(qr_OLDLENSORDER, 1); |
| 2840 |
1/2✓ Branch 0 taken 82 times.
✗ Branch 1 not taken.
|
82 | set_qr(qr_NOFAIRYGUYFIRES, 1); |
| 2841 |
1/2✓ Branch 0 taken 82 times.
✗ Branch 1 not taken.
|
82 | set_qr(qr_TRIGGERSREPEAT, 1); |
| 2842 | 82 | } | |
| 2843 | |||
| 2844 |
3/4✓ Branch 0 taken 455 times.
✓ Branch 1 taken 23 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 455 times.
|
478 | if((tempheader.zelda_version < 0x193)||((tempheader.zelda_version == 0x193)&&(tempheader.build<3))) |
| 2845 | { | ||
| 2846 |
1/2✓ Branch 0 taken 23 times.
✗ Branch 1 not taken.
|
23 | set_qr(qr_WALLFLIERS,1); |
| 2847 | 23 | } | |
| 2848 | |||
| 2849 |
3/4✓ Branch 0 taken 455 times.
✓ Branch 1 taken 23 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 455 times.
|
478 | if((tempheader.zelda_version < 0x193)||((tempheader.zelda_version == 0x193)&&(tempheader.build<4))) |
| 2850 | { | ||
| 2851 |
1/2✓ Branch 0 taken 23 times.
✗ Branch 1 not taken.
|
23 | set_qr(qr_NOBOMBPALFLASH,1); |
| 2852 | 23 | } | |
| 2853 | |||
| 2854 |
3/4✓ Branch 0 taken 455 times.
✓ Branch 1 taken 23 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 455 times.
|
478 | if((tempheader.zelda_version < 0x193)||((tempheader.zelda_version == 0x193)&&(tempheader.build<3))) |
| 2855 | { | ||
| 2856 |
1/2✓ Branch 0 taken 23 times.
✗ Branch 1 not taken.
|
23 | set_qr(qr_NOSCROLLCONTINUE,1); |
| 2857 | 23 | } | |
| 2858 | |||
| 2859 |
2/2✓ Branch 0 taken 82 times.
✓ Branch 1 taken 396 times.
|
478 | if(tempheader.zelda_version <= 0x210) |
| 2860 | { | ||
| 2861 |
1/2✓ Branch 0 taken 82 times.
✗ Branch 1 not taken.
|
82 | set_qr(qr_ARROWCLIP,1); |
| 2862 | 82 | } | |
| 2863 | |||
| 2864 |
2/2✓ Branch 0 taken 59 times.
✓ Branch 1 taken 419 times.
|
478 | if(tempheader.zelda_version == 0x210) |
| 2865 | { | ||
| 2866 |
1/2✓ Branch 0 taken 59 times.
✗ Branch 1 not taken.
|
59 | set_qr(qr_NOSCROLLCONTINUE, get_qr(qr_CMBCYCLELAYERS)); |
| 2867 |
1/2✓ Branch 0 taken 59 times.
✗ Branch 1 not taken.
|
59 | set_qr(qr_CMBCYCLELAYERS, 0); |
| 2868 |
1/2✓ Branch 0 taken 59 times.
✗ Branch 1 not taken.
|
59 | set_qr(qr_CONT_SWORD_TRIGGERS, 1); |
| 2869 | 59 | } | |
| 2870 | |||
| 2871 |
2/2✓ Branch 0 taken 82 times.
✓ Branch 1 taken 396 times.
|
478 | if(tempheader.zelda_version <= 0x210) |
| 2872 | { | ||
| 2873 |
1/2✓ Branch 0 taken 82 times.
✗ Branch 1 not taken.
|
82 | set_qr(qr_OLDSTYLEWARP,1); |
| 2874 |
1/2✓ Branch 0 taken 82 times.
✗ Branch 1 not taken.
|
82 | set_qr(qr_210_WARPRETURN,1); |
| 2875 | 82 | } | |
| 2876 | |||
| 2877 | //might not be correct | ||
| 2878 |
2/2✓ Branch 0 taken 23 times.
✓ Branch 1 taken 455 times.
|
478 | if(tempheader.zelda_version < 0x210) |
| 2879 | { | ||
| 2880 |
1/2✓ Branch 0 taken 23 times.
✗ Branch 1 not taken.
|
23 | set_bit(deprecated_rules, qr_OLDTRIBBLES_DEP,1); |
| 2881 |
1/2✓ Branch 0 taken 23 times.
✗ Branch 1 not taken.
|
23 | set_qr(qr_OLDTRIBBLES_DEP,1); |
| 2882 |
1/2✓ Branch 0 taken 23 times.
✗ Branch 1 not taken.
|
23 | set_qr(qr_OLDHOOKSHOTGRAB,1); |
| 2883 | 23 | } | |
| 2884 | |||
| 2885 |
2/2✓ Branch 0 taken 82 times.
✓ Branch 1 taken 396 times.
|
478 | if(tempheader.zelda_version < 0x211) |
| 2886 | { | ||
| 2887 |
1/2✓ Branch 0 taken 82 times.
✗ Branch 1 not taken.
|
82 | set_qr(qr_WRONG_BRANG_TRAIL_DIR,1); |
| 2888 | 82 | } | |
| 2889 | |||
| 2890 |
2/2✓ Branch 0 taken 5 times.
✓ Branch 1 taken 473 times.
|
478 | if((tempheader.zelda_version == 0x192 && tempheader.build <= 163) || tempheader.zelda_version < 0x192) |
| 2891 | { | ||
| 2892 |
2/2✓ Branch 0 taken 22 times.
✓ Branch 1 taken 456 times.
|
478 | set_qr(qr_192b163_WARP,1); |
| 2893 | 22 | } | |
| 2894 | |||
| 2895 |
2/2✓ Branch 0 taken 59 times.
✓ Branch 1 taken 49 times.
|
22 | if(tempheader.zelda_version == 0x210) |
| 2896 | { | ||
| 2897 |
1/2✓ Branch 0 taken 59 times.
✗ Branch 1 not taken.
|
59 | set_bit(deprecated_rules, qr_OLDTRIBBLES_DEP, get_qr(qr_DMGCOMBOPRI)); |
| 2898 |
1/2✓ Branch 0 taken 59 times.
✗ Branch 1 not taken.
|
59 | set_qr(qr_OLDTRIBBLES_DEP, get_qr(qr_DMGCOMBOPRI)); |
| 2899 |
1/2✓ Branch 0 taken 59 times.
✗ Branch 1 not taken.
|
59 | set_qr(qr_DMGCOMBOPRI, 0); |
| 2900 | 59 | } | |
| 2901 | |||
| 2902 |
3/4✓ Branch 0 taken 396 times.
✓ Branch 1 taken 288 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 396 times.
|
108 | if(tempheader.zelda_version < 0x211 || (tempheader.zelda_version == 0x211 && tempheader.build<15)) |
| 2903 | { | ||
| 2904 |
2/2✓ Branch 0 taken 82 times.
✓ Branch 1 taken 206 times.
|
288 | set_qr(qr_OLDPICKUP,1); |
| 2905 | 82 | } | |
| 2906 | |||
| 2907 |
3/4✓ Branch 0 taken 396 times.
✓ Branch 1 taken 82 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 396 times.
|
478 | if(tempheader.zelda_version < 0x211 || (tempheader.zelda_version == 0x211 && tempheader.build < 18)) |
| 2908 | { | ||
| 2909 |
1/2✓ Branch 0 taken 82 times.
✗ Branch 1 not taken.
|
82 | set_qr(qr_NOSOLIDDAMAGECOMBOS, 1); |
| 2910 |
1/2✓ Branch 0 taken 82 times.
✗ Branch 1 not taken.
|
82 | set_qr(qr_ITEMPICKUPSETSBELOW, 1); // broke around build 400 |
| 2911 | 82 | } | |
| 2912 | |||
| 2913 |
2/2✓ Branch 0 taken 82 times.
✓ Branch 1 taken 396 times.
|
478 | if(tempheader.zelda_version < 0x250) // version<0x250 checks for beta 18; build was set to 18 prematurely |
| 2914 | { | ||
| 2915 |
1/2✓ Branch 0 taken 82 times.
✗ Branch 1 not taken.
|
82 | set_qr(qr_HOOKSHOTDOWNBUG, 1); |
| 2916 | 82 | } | |
| 2917 | |||
| 2918 |
4/4✓ Branch 0 taken 200 times.
✓ Branch 1 taken 278 times.
✓ Branch 2 taken 31 times.
✓ Branch 3 taken 169 times.
|
478 | if(tempheader.zelda_version == 0x250 && tempheader.build == 24) // Annoying... |
| 2919 | { | ||
| 2920 |
1/2✓ Branch 0 taken 31 times.
✗ Branch 1 not taken.
|
31 | set_qr(qr_PEAHATCLOCKVULN, 1); |
| 2921 | 31 | } | |
| 2922 | |||
| 2923 |
4/4✓ Branch 0 taken 396 times.
✓ Branch 1 taken 82 times.
✓ Branch 2 taken 200 times.
✓ Branch 3 taken 196 times.
|
478 | if(tempheader.zelda_version < 0x250 || (tempheader.zelda_version == 0x250 && tempheader.build < 22)) //22 is 2.50.0 RC4. Gotta set the door repair QR... -Dimi |
| 2924 | { | ||
| 2925 |
2/2✓ Branch 0 taken 82 times.
✓ Branch 1 taken 200 times.
|
282 | set_qr(qr_OLD_DOORREPAIR, 1); |
| 2926 | 82 | } | |
| 2927 | |||
| 2928 |
4/4✓ Branch 0 taken 396 times.
✓ Branch 1 taken 118 times.
✓ Branch 2 taken 200 times.
✓ Branch 3 taken 196 times.
|
278 | if(tempheader.zelda_version < 0x250 || (tempheader.zelda_version == 0x250 && tempheader.build < 20)) //20 is 2.50.0 RC1 and RC2 (cause it didn't get bumped). Okay I'm gonna be honest I have no idea if any 2.50 build was available before RC1, but gonna try and cover my ass here -Dimi |
| 2929 | { | ||
| 2930 |
2/2✓ Branch 0 taken 82 times.
✓ Branch 1 taken 236 times.
|
318 | set_qr(qr_OLD_SECRETMONEY, 1); |
| 2931 | 82 | } | |
| 2932 | |||
| 2933 |
4/4✓ Branch 0 taken 396 times.
✓ Branch 1 taken 118 times.
✓ Branch 2 taken 200 times.
✓ Branch 3 taken 196 times.
|
278 | if(tempheader.zelda_version < 0x250 || (tempheader.zelda_version == 0x250 && tempheader.build < 28)) //28 is 2.50.1 final. Potion bug might have been used, I dunno. -Dimi |
| 2934 | { | ||
| 2935 |
2/2✓ Branch 0 taken 137 times.
✓ Branch 1 taken 181 times.
|
318 | set_qr(qr_OLD_POTION_OR_HC, 1); |
| 2936 | 137 | } | |
| 2937 | |||
| 2938 |
4/4✓ Branch 0 taken 396 times.
✓ Branch 1 taken 63 times.
✓ Branch 2 taken 200 times.
✓ Branch 3 taken 196 times.
|
333 | if(tempheader.zelda_version < 0x250 || (tempheader.zelda_version == 0x250 && tempheader.build<28)) |
| 2939 | { | ||
| 2940 |
2/2✓ Branch 0 taken 137 times.
✓ Branch 1 taken 126 times.
|
263 | set_qr(qr_OFFSCREENWEAPONS, 1); |
| 2941 | 137 | } | |
| 2942 | |||
| 2943 | //Bombchu fix. | ||
| 2944 |
2/2✓ Branch 0 taken 135 times.
✓ Branch 1 taken 200 times.
|
333 | if(tempheader.zelda_version == 0x250) |
| 2945 | { | ||
| 2946 |
2/2✓ Branch 0 taken 31 times.
✓ Branch 1 taken 169 times.
|
200 | if ( tempheader.build == 24 ) //2.50.0 |
| 2947 | { | ||
| 2948 |
1/2✓ Branch 0 taken 31 times.
✗ Branch 1 not taken.
|
31 | set_qr(qr_BOMBCHUSUPERBOMB, 1); |
| 2949 | 31 | } | |
| 2950 |
2/2✓ Branch 0 taken 6 times.
✓ Branch 1 taken 194 times.
|
200 | if ( tempheader.build == 28 ) //2.50.1 |
| 2951 | { | ||
| 2952 |
1/2✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
|
6 | set_qr(qr_BOMBCHUSUPERBOMB, 1); |
| 2953 | 6 | } | |
| 2954 |
2/2✓ Branch 0 taken 81 times.
✓ Branch 1 taken 119 times.
|
200 | if ( tempheader.build == 29 ) //2.50.2 |
| 2955 | { | ||
| 2956 |
1/2✓ Branch 0 taken 81 times.
✗ Branch 1 not taken.
|
81 | set_qr(qr_BOMBCHUSUPERBOMB, 0); |
| 2957 | 81 | } | |
| 2958 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 200 times.
|
200 | if ( tempheader.build == 30 ) //2.50.3RC1 |
| 2959 | { | ||
| 2960 | ✗ | set_qr(qr_BOMBCHUSUPERBOMB, 0); | |
| 2961 | ✗ | } | |
| 2962 | 200 | } | |
| 2963 | |||
| 2964 |
4/4✓ Branch 0 taken 396 times.
✓ Branch 1 taken 61 times.
✓ Branch 2 taken 200 times.
✓ Branch 3 taken 196 times.
|
335 | if(tempheader.zelda_version < 0x250 || (tempheader.zelda_version == 0x250 && tempheader.build<29)) |
| 2965 | { | ||
| 2966 | // qr_OFFSETEWPNCOLLISIONFIX | ||
| 2967 | // All 'official' quests need this disabled. | ||
| 2968 | // All 2.10 and lower quests need this enabled to preseve compatability. | ||
| 2969 | // All 2.11 - 2.5.1 quests should have it set also, due to a bug in about half of all the betas. | ||
| 2970 | |||
| 2971 | //~Gleeok | ||
| 2972 |
2/2✓ Branch 0 taken 143 times.
✓ Branch 1 taken 118 times.
|
261 | set_qr(qr_OFFSETEWPNCOLLISIONFIX, 1); //This has to be set!!!! |
| 2973 | |||
| 2974 | // Broke in build 695 | ||
| 2975 |
3/4✓ Branch 0 taken 61 times.
✓ Branch 1 taken 82 times.
✓ Branch 2 taken 61 times.
✗ Branch 3 not taken.
|
143 | if(tempheader.zelda_version>=0x211 && tempheader.build>=18) |
| 2976 |
1/2✓ Branch 0 taken 61 times.
✗ Branch 1 not taken.
|
61 | set_qr(qr_BROKENSTATUES, 1); |
| 2977 | 143 | } | |
| 2978 |
11/14✓ Branch 0 taken 121 times.
✓ Branch 1 taken 460 times.
✓ Branch 2 taken 455 times.
✓ Branch 3 taken 5 times.
✓ Branch 4 taken 5 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 576 times.
✓ Branch 7 taken 5 times.
✓ Branch 8 taken 576 times.
✓ Branch 9 taken 5 times.
✓ Branch 10 taken 22 times.
✓ Branch 11 taken 559 times.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
|
339 | if (tempheader.zelda_version <= 0x190 || (tempheader.zelda_version == 0x192 && std::string(tempheader.title).starts_with("Zelda 3000\0"))) |
| 2979 | { | ||
| 2980 |
1/2✓ Branch 0 taken 22 times.
✗ Branch 1 not taken.
|
22 | set_qr(qr_COPIED_SWIM_SPRITES, 1); |
| 2981 | 22 | } | |
| 2982 |
8/8✓ Branch 0 taken 200 times.
✓ Branch 1 taken 381 times.
✓ Branch 2 taken 291 times.
✓ Branch 3 taken 90 times.
✓ Branch 4 taken 209 times.
✓ Branch 5 taken 82 times.
✓ Branch 6 taken 196 times.
✓ Branch 7 taken 13 times.
|
581 | if ( (tempheader.zelda_version == 0x250 && tempheader.build < 33) || tempheader.zelda_version == 0x254 || tempheader.zelda_version < 0x250 || (tempheader.zelda_version == 0x255 && tempheader.build < 50) ) |
| 2983 | { | ||
| 2984 |
2/2✓ Branch 0 taken 269 times.
✓ Branch 1 taken 299 times.
|
568 | set_qr(qr_OLD_SLASHNEXT_SECRETS, 1); |
| 2985 | 269 | } | |
| 2986 | |||
| 2987 |
2/2✓ Branch 0 taken 82 times.
✓ Branch 1 taken 200 times.
|
282 | if ( (tempheader.zelda_version < 0x211) ) //2.10 water and ladder interaction |
| 2988 | { | ||
| 2989 |
1/2✓ Branch 0 taken 82 times.
✗ Branch 1 not taken.
|
82 | set_qr(qr_OLD_210_WATER, 1); |
| 2990 | 82 | } | |
| 2991 | |||
| 2992 |
4/6✓ Branch 0 taken 196 times.
✓ Branch 1 taken 168 times.
✓ Branch 2 taken 196 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 196 times.
|
282 | if ( (tempheader.zelda_version < 0x255 ) || (tempheader.zelda_version == 0x255 && tempheader.build < 51 ) ) //2.10 water and ladder interaction |
| 2993 | { | ||
| 2994 |
2/2✓ Branch 0 taken 282 times.
✓ Branch 1 taken 114 times.
|
168 | set_qr(qr_STEP_IS_FLOAT,0); |
| 2995 | 282 | } | |
| 2996 | |||
| 2997 |
2/2✓ Branch 0 taken 82 times.
✓ Branch 1 taken 396 times.
|
478 | if ( tempheader.zelda_version < 0x250 ) |
| 2998 | { | ||
| 2999 |
1/2✓ Branch 0 taken 82 times.
✗ Branch 1 not taken.
|
82 | set_qr(qr_8WAY_SHOT_SFX_DEP, 1); |
| 3000 | 82 | } | |
| 3001 | |||
| 3002 |
2/2✓ Branch 0 taken 82 times.
✓ Branch 1 taken 396 times.
|
478 | if(s_version < 3) |
| 3003 | { | ||
| 3004 |
1/2✓ Branch 0 taken 82 times.
✗ Branch 1 not taken.
|
82 | set_qr(qr_HOLDNOSTOPMUSIC, 1); |
| 3005 |
1/2✓ Branch 0 taken 82 times.
✗ Branch 1 not taken.
|
82 | set_qr(qr_CAVEEXITNOSTOPMUSIC, 1); |
| 3006 | 82 | } | |
| 3007 | |||
| 3008 |
2/2✓ Branch 0 taken 82 times.
✓ Branch 1 taken 396 times.
|
478 | if(s_version<4) |
| 3009 | { | ||
| 3010 |
1/2✓ Branch 0 taken 82 times.
✗ Branch 1 not taken.
|
82 | set_qr(10,0); |
| 3011 | 82 | } | |
| 3012 | |||
| 3013 |
2/2✓ Branch 0 taken 82 times.
✓ Branch 1 taken 396 times.
|
478 | if(s_version<5) |
| 3014 | { | ||
| 3015 |
1/2✓ Branch 0 taken 82 times.
✗ Branch 1 not taken.
|
82 | set_qr(27,0); |
| 3016 | 82 | } | |
| 3017 | |||
| 3018 |
2/2✓ Branch 0 taken 82 times.
✓ Branch 1 taken 396 times.
|
478 | if(s_version<6) |
| 3019 | { | ||
| 3020 |
1/2✓ Branch 0 taken 82 times.
✗ Branch 1 not taken.
|
82 | set_qr(46,0); |
| 3021 | 82 | } | |
| 3022 | |||
| 3023 |
2/2✓ Branch 0 taken 82 times.
✓ Branch 1 taken 396 times.
|
478 | if(s_version<7) // January 2008 |
| 3024 | { | ||
| 3025 |
1/2✓ Branch 0 taken 82 times.
✗ Branch 1 not taken.
|
82 | set_qr(qr_HEARTSREQUIREDFIX,0); |
| 3026 |
1/2✓ Branch 0 taken 82 times.
✗ Branch 1 not taken.
|
82 | set_qr(qr_PUSHBLOCKCSETFIX,1); |
| 3027 | 82 | } | |
| 3028 | |||
| 3029 |
2/2✓ Branch 0 taken 82 times.
✓ Branch 1 taken 396 times.
|
478 | if(s_version<8) |
| 3030 | { | ||
| 3031 |
1/2✓ Branch 0 taken 82 times.
✗ Branch 1 not taken.
|
82 | set_qr(12, 0); |
| 3032 | 82 | } | |
| 3033 | else | ||
| 3034 | { | ||
| 3035 |
1/2✓ Branch 0 taken 396 times.
✗ Branch 1 not taken.
|
396 | set_bit(deprecated_rules, 12, 0); |
| 3036 | } | ||
| 3037 | |||
| 3038 |
2/2✓ Branch 0 taken 82 times.
✓ Branch 1 taken 396 times.
|
478 | if(s_version<9) // October 2008 |
| 3039 | { | ||
| 3040 |
1/2✓ Branch 0 taken 82 times.
✗ Branch 1 not taken.
|
82 | set_qr(qr_NOROPE2FLASH_DEP,0); |
| 3041 |
1/2✓ Branch 0 taken 82 times.
✗ Branch 1 not taken.
|
82 | set_qr(qr_NOBUBBLEFLASH_DEP,0); |
| 3042 |
1/2✓ Branch 0 taken 82 times.
✗ Branch 1 not taken.
|
82 | set_qr(qr_GHINI2BLINK_DEP,0); |
| 3043 |
1/2✓ Branch 0 taken 82 times.
✗ Branch 1 not taken.
|
82 | set_qr(qr_PHANTOMGHINI2_DEP,0); |
| 3044 | 82 | } | |
| 3045 | |||
| 3046 |
2/2✓ Branch 0 taken 82 times.
✓ Branch 1 taken 396 times.
|
478 | if(s_version<10) // December 2008 |
| 3047 | { | ||
| 3048 |
1/2✓ Branch 0 taken 82 times.
✗ Branch 1 not taken.
|
82 | set_qr(qr_NOCLOCKS_DEP,0); |
| 3049 |
1/2✓ Branch 0 taken 82 times.
✗ Branch 1 not taken.
|
82 | set_qr(qr_ALLOW10RUPEEDROPS_DEP,0); |
| 3050 | 82 | } | |
| 3051 | |||
| 3052 |
2/2✓ Branch 0 taken 82 times.
✓ Branch 1 taken 396 times.
|
478 | if(s_version<11) // April 2009 |
| 3053 | { | ||
| 3054 |
1/2✓ Branch 0 taken 82 times.
✗ Branch 1 not taken.
|
82 | set_qr(qr_SLOWENEMYANIM_DEP,0); |
| 3055 | 82 | } | |
| 3056 | |||
| 3057 | // This served no purpose. | ||
| 3058 | // if(s_version<12) // December 2009 | ||
| 3059 | // { | ||
| 3060 | // set_qr(qr_BRKBLSHLDS_DEP,0); | ||
| 3061 | // set_qr(qr_OLDTRIBBLES_DEP,0); | ||
| 3062 | // } | ||
| 3063 | |||
| 3064 | //if(tempheader.zelda_version < 0x250 || (tempheader.zelda_version == 0x250 && tempheader.build < 24)) | ||
| 3065 |
2/2✓ Branch 0 taken 82 times.
✓ Branch 1 taken 396 times.
|
478 | if(s_version < 13) |
| 3066 | { | ||
| 3067 |
1/2✓ Branch 0 taken 82 times.
✗ Branch 1 not taken.
|
82 | set_qr(qr_SHOPCHEAT, 1); |
| 3068 | 82 | } | |
| 3069 | |||
| 3070 | // Not entirely sure this is the best place for this... | ||
| 3071 | //2.50.2 bitmap offset fix | ||
| 3072 | 478 | memset(extra_rules, 0, EXTRARULES_SIZE); | |
| 3073 |
4/4✓ Branch 0 taken 396 times.
✓ Branch 1 taken 82 times.
✓ Branch 2 taken 200 times.
✓ Branch 3 taken 196 times.
|
478 | if(tempheader.zelda_version < 0x250 || (tempheader.zelda_version == 0x250 && tempheader.build<29)) |
| 3074 | { | ||
| 3075 |
2/2✓ Branch 0 taken 143 times.
✓ Branch 1 taken 139 times.
|
282 | set_er(er_BITMAPOFFSET, 1); |
| 3076 |
1/2✓ Branch 0 taken 143 times.
✗ Branch 1 not taken.
|
143 | set_qr(qr_BITMAPOFFSETFIX, 1); |
| 3077 | 143 | } | |
| 3078 | //required because quest templates also used this bit, although | ||
| 3079 | //it never did anything, before. -Z | ||
| 3080 |
2/2✓ Branch 0 taken 200 times.
✓ Branch 1 taken 141 times.
|
339 | if ( tempheader.zelda_version == 0x250 ) |
| 3081 | { | ||
| 3082 |
5/6✓ Branch 0 taken 119 times.
✓ Branch 1 taken 81 times.
✓ Branch 2 taken 119 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 16 times.
✓ Branch 5 taken 103 times.
|
200 | if( tempheader.build == 29 || tempheader.build == 30 || tempheader.build == 31 ) |
| 3083 | { | ||
| 3084 |
1/2✓ Branch 0 taken 97 times.
✗ Branch 1 not taken.
|
97 | set_er(er_BITMAPOFFSET, 0); |
| 3085 |
1/2✓ Branch 0 taken 97 times.
✗ Branch 1 not taken.
|
97 | set_qr(qr_BITMAPOFFSETFIX, 0); |
| 3086 | 97 | } | |
| 3087 | 200 | } | |
| 3088 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 341 times.
|
341 | if ( tempheader.zelda_version == 0x254 ) |
| 3089 | { | ||
| 3090 | ✗ | set_er(er_BITMAPOFFSET, 0); | |
| 3091 | ✗ | set_qr(qr_BITMAPOFFSETFIX, 0); | |
| 3092 | ✗ | } | |
| 3093 |
3/4✓ Branch 0 taken 196 times.
✓ Branch 1 taken 145 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 196 times.
|
341 | if ( tempheader.zelda_version == 0x255 && tempheader.build < 42 ) //QR was added to 255 in this build. |
| 3094 | { | ||
| 3095 | ✗ | set_er(er_BITMAPOFFSET, 0); | |
| 3096 | ✗ | set_qr(qr_BITMAPOFFSETFIX, 0); | |
| 3097 | ✗ | } | |
| 3098 | //optimise fast drawing for older versions. | ||
| 3099 |
3/4✓ Branch 0 taken 196 times.
✓ Branch 1 taken 145 times.
✓ Branch 2 taken 196 times.
✗ Branch 3 not taken.
|
341 | if ( tempheader.zelda_version < 0x255 || (tempheader.zelda_version == 0x255 && tempheader.build < 42) ) |
| 3100 | { | ||
| 3101 |
2/2✓ Branch 0 taken 282 times.
✓ Branch 1 taken 105 times.
|
341 | set_qr(qr_OLDSPRITEDRAWS, 1); |
| 3102 | 282 | } | |
| 3103 | //Old eweapon->Parent (was added in 2.54, Alpha 19) | ||
| 3104 | //The change was made in build 43, but I'm setting this to < 42, because quests made in 42 would benefit from this change, and | ||
| 3105 | //older quests can set the rule by hand. We need a new qst.dat again. | ||
| 3106 |
4/4✓ Branch 0 taken 478 times.
✓ Branch 1 taken 196 times.
✓ Branch 2 taken 196 times.
✓ Branch 3 taken 282 times.
|
282 | if ( tempheader.zelda_version == 0x254 || (tempheader.zelda_version == 0x255 && tempheader.build < 42) ) |
| 3107 | { | ||
| 3108 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 392 times.
|
392 | set_qr(qr_OLDEWPNPARENT, 1); |
| 3109 | ✗ | } | |
| 3110 |
4/4✓ Branch 0 taken 478 times.
✓ Branch 1 taken 196 times.
✓ Branch 2 taken 196 times.
✓ Branch 3 taken 282 times.
|
282 | if ( tempheader.zelda_version == 0x254 || (tempheader.zelda_version == 0x255 && tempheader.build < 44) ) |
| 3111 | { | ||
| 3112 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 392 times.
|
392 | set_qr(qr_OLDCREATEBITMAP_ARGS, 1); |
| 3113 | ✗ | } | |
| 3114 |
4/4✓ Branch 0 taken 478 times.
✓ Branch 1 taken 196 times.
✓ Branch 2 taken 196 times.
✓ Branch 3 taken 282 times.
|
282 | if ( tempheader.zelda_version == 0x254 || (tempheader.zelda_version == 0x255 && tempheader.build < 45) ) |
| 3115 | { | ||
| 3116 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 392 times.
|
392 | set_qr(qr_OLDQUESTMISC, 1); |
| 3117 | ✗ | } | |
| 3118 |
1/2✓ Branch 0 taken 282 times.
✗ Branch 1 not taken.
|
282 | if ( tempheader.zelda_version < 0x254 ) |
| 3119 | { | ||
| 3120 |
1/2✓ Branch 0 taken 282 times.
✗ Branch 1 not taken.
|
282 | set_qr(qr_OLDCREATEBITMAP_ARGS, 0); |
| 3121 |
1/2✓ Branch 0 taken 282 times.
✗ Branch 1 not taken.
|
282 | set_qr(qr_OLDEWPNPARENT, 0); |
| 3122 |
1/2✓ Branch 0 taken 282 times.
✗ Branch 1 not taken.
|
282 | set_qr(qr_OLDQUESTMISC, 0); |
| 3123 | 282 | } | |
| 3124 | |||
| 3125 | //item scripts continue to run | ||
| 3126 |
3/4✓ Branch 0 taken 196 times.
✓ Branch 1 taken 168 times.
✓ Branch 2 taken 196 times.
✗ Branch 3 not taken.
|
282 | if ( tempheader.zelda_version < 0x255 || (tempheader.zelda_version == 0x255 && tempheader.build < 44) ) |
| 3127 | { | ||
| 3128 |
2/2✓ Branch 0 taken 282 times.
✓ Branch 1 taken 82 times.
|
364 | set_qr(qr_ITEMSCRIPTSKEEPRUNNING, 0); |
| 3129 |
1/2✓ Branch 0 taken 282 times.
✗ Branch 1 not taken.
|
282 | set_qr(qr_SCRIPTSRUNINHEROSTEPFORWARD, 0); |
| 3130 |
1/2✓ Branch 0 taken 282 times.
✗ Branch 1 not taken.
|
282 | set_qr(qr_FIXSCRIPTSDURINGSCROLLING, 0); |
| 3131 |
1/2✓ Branch 0 taken 282 times.
✗ Branch 1 not taken.
|
282 | set_qr(qr_SCRIPTDRAWSINWARPS, 0); |
| 3132 |
1/2✓ Branch 0 taken 282 times.
✗ Branch 1 not taken.
|
282 | set_qr(qr_DYINGENEMYESDONTHURTHERO, 0); |
| 3133 |
1/2✓ Branch 0 taken 282 times.
✗ Branch 1 not taken.
|
282 | set_qr(qr_OUTOFBOUNDSENEMIES, 0); |
| 3134 |
1/2✓ Branch 0 taken 282 times.
✗ Branch 1 not taken.
|
282 | set_qr(qr_SPRITEXY_IS_FLOAT, 0); |
| 3135 | 282 | } | |
| 3136 | |||
| 3137 |
3/4✓ Branch 0 taken 196 times.
✓ Branch 1 taken 168 times.
✓ Branch 2 taken 196 times.
✗ Branch 3 not taken.
|
282 | if ( tempheader.zelda_version < 0x255 || (tempheader.zelda_version == 0x255 && tempheader.build < 46) ) |
| 3138 | { | ||
| 3139 |
2/2✓ Branch 0 taken 282 times.
✓ Branch 1 taken 82 times.
|
364 | set_qr(qr_CLEARINITDONSCRIPTCHANGE, 1); |
| 3140 | 282 | } | |
| 3141 |
3/4✓ Branch 0 taken 196 times.
✓ Branch 1 taken 168 times.
✓ Branch 2 taken 196 times.
✗ Branch 3 not taken.
|
282 | if ( tempheader.zelda_version < 0x255 || (tempheader.zelda_version == 0x255 && tempheader.build < 46) ) |
| 3142 | { | ||
| 3143 |
2/2✓ Branch 0 taken 282 times.
✓ Branch 1 taken 82 times.
|
364 | set_qr(qr_TRACESCRIPTIDS, 0); |
| 3144 |
1/2✓ Branch 0 taken 282 times.
✗ Branch 1 not taken.
|
282 | set_qr(qr_SCRIPT_FRIENDLY_ENEMY_TYPES, 1); |
| 3145 |
1/2✓ Branch 0 taken 282 times.
✗ Branch 1 not taken.
|
282 | set_qr(qr_PARSER_BOOL_TRUE_DECIMAL, 1); |
| 3146 |
1/2✓ Branch 0 taken 282 times.
✗ Branch 1 not taken.
|
282 | set_qr(qr_PARSER_250DIVISION,1); |
| 3147 |
1/2✓ Branch 0 taken 282 times.
✗ Branch 1 not taken.
|
282 | set_qr(qr_PARSER_BOOL_TRUE_DECIMAL,1); |
| 3148 |
1/2✓ Branch 0 taken 282 times.
✗ Branch 1 not taken.
|
282 | set_qr(qr_PARSER_TRUE_INT_SIZE,0); |
| 3149 |
1/2✓ Branch 0 taken 282 times.
✗ Branch 1 not taken.
|
282 | set_qr(qr_PARSER_FORCE_INLINE,0); |
| 3150 |
1/2✓ Branch 0 taken 282 times.
✗ Branch 1 not taken.
|
282 | set_qr(qr_PARSER_BINARY_32BIT,0); |
| 3151 |
2/2✓ Branch 0 taken 8 times.
✓ Branch 1 taken 274 times.
|
282 | if ( get_qr(qr_SELECTAWPN) ) |
| 3152 | { | ||
| 3153 |
1/2✓ Branch 0 taken 8 times.
✗ Branch 1 not taken.
|
8 | set_qr(qr_NO_L_R_BUTTON_INVENTORY_SWAP,1); |
| 3154 | //In < 2.55a27, if you had an A+B subscreen, L and R didn't shift through inventory. | ||
| 3155 | //Now they **do**, unless you disable that behaviour. | ||
| 3156 | //For the sake of compatibility, old quests with the A+B subscreen rule enabed | ||
| 3157 | //now enable the disable L/R item swap on load. | ||
| 3158 | 8 | } | |
| 3159 | |||
| 3160 | 282 | } | |
| 3161 |
3/4✓ Branch 0 taken 196 times.
✓ Branch 1 taken 168 times.
✓ Branch 2 taken 196 times.
✗ Branch 3 not taken.
|
282 | if ( tempheader.zelda_version < 0x255 || (tempheader.zelda_version == 0x255 && tempheader.build < 47) ) |
| 3162 | { | ||
| 3163 | //Compatibility: Setting the hero's action to rafting was previously disallowed, though legal for scripts to attempt. | ||
| 3164 |
2/2✓ Branch 0 taken 282 times.
✓ Branch 1 taken 82 times.
|
364 | set_qr(qr_DISALLOW_SETTING_RAFTING, 1); |
| 3165 | //Compatibility: The calculation for when to loop an animation did not factor in ASkipY correctly, resulting in | ||
| 3166 | //animations ending earlier than they should. | ||
| 3167 |
1/2✓ Branch 0 taken 282 times.
✗ Branch 1 not taken.
|
282 | set_qr(qr_BROKEN_ASKIP_Y_FRAMES, 1); |
| 3168 | //Enemies would ignore solidity on the top half of combos | ||
| 3169 |
1/2✓ Branch 0 taken 282 times.
✗ Branch 1 not taken.
|
282 | set_qr(qr_ENEMY_BROKEN_TOP_HALF_SOLIDITY, 1); |
| 3170 | //Ceiling collison was a bit wonky, including hitting your head before you are near the ceiling or clipping into it slightly. | ||
| 3171 |
1/2✓ Branch 0 taken 282 times.
✗ Branch 1 not taken.
|
282 | set_qr(qr_OLD_SIDEVIEW_CEILING_COLLISON, 1); |
| 3172 | //If an itemdata had a 'frames' of 0, items created of that data would ignore all changes to 'frames' | ||
| 3173 |
1/2✓ Branch 0 taken 282 times.
✗ Branch 1 not taken.
|
282 | set_qr(qr_0AFRAME_ITEMS_IGNORE_AFRAME_CHANGES, 1); |
| 3174 | //Collision used some odd calculations before, and enemies could not be hit back into the top row or left column | ||
| 3175 |
1/2✓ Branch 0 taken 282 times.
✗ Branch 1 not taken.
|
282 | set_qr(qr_OLD_ENEMY_KNOCKBACK_COLLISION, 1); |
| 3176 | 282 | } | |
| 3177 |
1/2✓ Branch 0 taken 282 times.
✗ Branch 1 not taken.
|
282 | if ( tempheader.zelda_version < 0x255 ) |
| 3178 | { | ||
| 3179 |
1/2✓ Branch 0 taken 282 times.
✗ Branch 1 not taken.
|
282 | set_qr(qr_NOFFCWAITDRAW, 1); |
| 3180 |
1/2✓ Branch 0 taken 282 times.
✗ Branch 1 not taken.
|
282 | set_qr(qr_NOITEMWAITDRAW, 1); |
| 3181 |
1/2✓ Branch 0 taken 282 times.
✗ Branch 1 not taken.
|
282 | set_qr(qr_SETENEMYWEAPONSPRITESONWPNCHANGE, 1); |
| 3182 |
1/2✓ Branch 0 taken 282 times.
✗ Branch 1 not taken.
|
282 | set_qr(qr_OLD_INIT_SCRIPT_TIMING, 1); |
| 3183 | //set_qr(qr_DO_NOT_DEALLOCATE_INIT_AND_SAVELOAD_ARRAYS, 1); | ||
| 3184 | 282 | } | |
| 3185 |
3/4✓ Branch 0 taken 196 times.
✓ Branch 1 taken 168 times.
✓ Branch 2 taken 196 times.
✗ Branch 3 not taken.
|
282 | if ( tempheader.zelda_version < 0x255 || ( tempheader.zelda_version == 0x255 && tempheader.build < 48 ) ) |
| 3186 | { | ||
| 3187 |
2/2✓ Branch 0 taken 282 times.
✓ Branch 1 taken 82 times.
|
364 | set_qr(qr_SETENEMYWEAPONSPRITESONWPNCHANGE, 1); |
| 3188 | 282 | } | |
| 3189 |
3/4✓ Branch 0 taken 196 times.
✓ Branch 1 taken 168 times.
✓ Branch 2 taken 196 times.
✗ Branch 3 not taken.
|
282 | if( tempheader.zelda_version < 0x255 || ( tempheader.zelda_version == 0x255 && tempheader.build < 52 ) ) |
| 3190 | { | ||
| 3191 |
2/2✓ Branch 0 taken 282 times.
✓ Branch 1 taken 82 times.
|
364 | set_qr(qr_OLD_PRINTF_ARGS, 1); |
| 3192 | 282 | } | |
| 3193 | |||
| 3194 | |||
| 3195 |
3/4✓ Branch 0 taken 196 times.
✓ Branch 1 taken 168 times.
✓ Branch 2 taken 196 times.
✗ Branch 3 not taken.
|
282 | if ( tempheader.zelda_version < 0x255 || (tempheader.zelda_version == 0x255 && tempheader.build < 54) ) |
| 3196 | { | ||
| 3197 |
2/2✓ Branch 0 taken 282 times.
✓ Branch 1 taken 82 times.
|
364 | set_qr(qr_BROKEN_RING_POWER, 1); |
| 3198 | 282 | } | |
| 3199 |
3/4✓ Branch 0 taken 196 times.
✓ Branch 1 taken 168 times.
✓ Branch 2 taken 196 times.
✗ Branch 3 not taken.
|
282 | if ( tempheader.zelda_version < 0x255 || (tempheader.zelda_version == 0x255 && tempheader.build < 56) ) |
| 3200 | { | ||
| 3201 |
2/2✓ Branch 0 taken 282 times.
✓ Branch 1 taken 82 times.
|
364 | set_qr(qr_NO_OVERWORLD_MAP_CHARTING, 1); |
| 3202 | 282 | } | |
| 3203 |
5/6✓ Branch 0 taken 196 times.
✓ Branch 1 taken 168 times.
✓ Branch 2 taken 196 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 114 times.
✓ Branch 5 taken 82 times.
|
282 | if ( tempheader.zelda_version < 0x255 || (tempheader.zelda_version == 0x255 && tempheader.build < 57) ) |
| 3204 | { | ||
| 3205 |
1/2✓ Branch 0 taken 282 times.
✗ Branch 1 not taken.
|
282 | set_qr(qr_DUNGEONS_USE_CLASSIC_CHARTING, 1); |
| 3206 | 282 | } | |
| 3207 |
3/4✓ Branch 0 taken 196 times.
✓ Branch 1 taken 168 times.
✓ Branch 2 taken 196 times.
✗ Branch 3 not taken.
|
364 | if ( tempheader.zelda_version < 0x255 || (tempheader.zelda_version == 0x255 && tempheader.build < 58) ) |
| 3208 | { | ||
| 3209 | //Rule used to be 'qr_SETXYBUTTONITEMS', now split. | ||
| 3210 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 282 times.
|
364 | if(get_qr(qr_SET_XBUTTON_ITEMS)) |
| 3211 | ✗ | set_qr(qr_SET_YBUTTON_ITEMS,1); | |
| 3212 | 282 | } | |
| 3213 |
3/4✓ Branch 0 taken 196 times.
✓ Branch 1 taken 168 times.
✓ Branch 2 taken 196 times.
✗ Branch 3 not taken.
|
282 | if ( tempheader.zelda_version < 0x255 || (tempheader.zelda_version == 0x255 && tempheader.build < 59) ) |
| 3214 | { | ||
| 3215 |
2/2✓ Branch 0 taken 282 times.
✓ Branch 1 taken 82 times.
|
364 | set_qr(qr_ALLOW_EDITING_COMBO_0,1); |
| 3216 | 282 | } | |
| 3217 |
3/4✓ Branch 0 taken 196 times.
✓ Branch 1 taken 168 times.
✓ Branch 2 taken 196 times.
✗ Branch 3 not taken.
|
282 | if ( tempheader.zelda_version < 0x255 || (tempheader.zelda_version == 0x255 && tempheader.build < 60) ) |
| 3218 | { | ||
| 3219 |
2/2✓ Branch 0 taken 282 times.
✓ Branch 1 taken 82 times.
|
364 | set_qr(qr_OLD_CHEST_COLLISION,1); |
| 3220 | 282 | } | |
| 3221 | |||
| 3222 |
1/2✓ Branch 0 taken 282 times.
✗ Branch 1 not taken.
|
282 | if ( tempheader.zelda_version < 0x254 ) |
| 3223 | { | ||
| 3224 |
1/2✓ Branch 0 taken 282 times.
✗ Branch 1 not taken.
|
282 | set_qr(qr_250WRITEEDEFSCRIPT, 1); |
| 3225 | 282 | } | |
| 3226 | //Sideview spikes in 2.50.0 | ||
| 3227 |
4/4✓ Branch 0 taken 396 times.
✓ Branch 1 taken 122 times.
✓ Branch 2 taken 200 times.
✓ Branch 3 taken 196 times.
|
282 | if(tempheader.zelda_version < 0x250 || (tempheader.zelda_version == 0x250 && tempheader.build<27)) //2.50.1RC3 |
| 3228 | { | ||
| 3229 |
2/2✓ Branch 0 taken 137 times.
✓ Branch 1 taken 185 times.
|
322 | set_qr(qr_OLDSIDEVIEWSPIKES, 1); |
| 3230 | 137 | } | |
| 3231 | //more 2.50 fixes -Z | ||
| 3232 |
4/4✓ Branch 0 taken 396 times.
✓ Branch 1 taken 63 times.
✓ Branch 2 taken 200 times.
✓ Branch 3 taken 196 times.
|
333 | if(tempheader.zelda_version < 0x250 || (tempheader.zelda_version == 0x250 && tempheader.build<31)) |
| 3233 | { | ||
| 3234 |
2/2✓ Branch 0 taken 224 times.
✓ Branch 1 taken 51 times.
|
263 | set_qr(qr_MELEEMAGICCOST, 0); |
| 3235 |
1/2✓ Branch 0 taken 224 times.
✗ Branch 1 not taken.
|
224 | set_qr(qr_GANONINTRO, 0); //This will get flipped later on in the compatrule 11 check. That's why it's turning it off. |
| 3236 |
1/2✓ Branch 0 taken 224 times.
✗ Branch 1 not taken.
|
224 | set_qr(qr_OLDMIRRORCOMBOS, 1); |
| 3237 |
1/2✓ Branch 0 taken 224 times.
✗ Branch 1 not taken.
|
224 | set_qr(qr_BROKENBOOKCOST, 1); |
| 3238 |
1/2✓ Branch 0 taken 224 times.
✗ Branch 1 not taken.
|
224 | set_qr(qr_BROKENCHARINTDRAWING, 1); |
| 3239 | |||
| 3240 | 224 | } | |
| 3241 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 420 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
420 | if(tempheader.zelda_version == 0x254 && tempheader.build<41) |
| 3242 | { | ||
| 3243 | //set_qr(qr_MELEEMAGICCOST, get_er(er_MAGICCOSTSWORD)); | ||
| 3244 | ✗ | set_qr(qr_MELEEMAGICCOST, 1); | |
| 3245 | ✗ | } | |
| 3246 | |||
| 3247 |
2/2✓ Branch 0 taken 23 times.
✓ Branch 1 taken 397 times.
|
420 | if(tempheader.zelda_version < 0x193) |
| 3248 | { | ||
| 3249 |
1/2✓ Branch 0 taken 23 times.
✗ Branch 1 not taken.
|
23 | set_qr(qr_SHORTDGNWALK, 1); |
| 3250 | 23 | } | |
| 3251 | |||
| 3252 |
2/2✓ Branch 0 taken 282 times.
✓ Branch 1 taken 138 times.
|
420 | if(tempheader.zelda_version < 0x255) |
| 3253 | { | ||
| 3254 |
1/2✓ Branch 0 taken 282 times.
✗ Branch 1 not taken.
|
282 | set_qr(qr_OLDINFMAGIC, 1); |
| 3255 | 282 | } | |
| 3256 | |||
| 3257 |
2/2✓ Branch 0 taken 82 times.
✓ Branch 1 taken 338 times.
|
420 | if((tempheader.zelda_version < 0x250)) //2.10 and earlier allowed the triforce to Warp Hero out of Item Cellars in Dungeons. -Z (15th March, 2019 ) |
| 3258 | { | ||
| 3259 |
1/2✓ Branch 0 taken 82 times.
✗ Branch 1 not taken.
|
82 | set_qr(qr_SIDEVIEWTRIFORCECELLAR,1); |
| 3260 | 82 | } | |
| 3261 | |||
| 3262 |
3/4✓ Branch 0 taken 196 times.
✓ Branch 1 taken 224 times.
✓ Branch 2 taken 196 times.
✗ Branch 3 not taken.
|
420 | if ( tempheader.zelda_version < 0x255 || (tempheader.zelda_version == 0x255 && tempheader.build < 47) ) |
| 3263 | { | ||
| 3264 |
2/2✓ Branch 0 taken 282 times.
✓ Branch 1 taken 138 times.
|
420 | set_qr(qr_OLD_F6,1); |
| 3265 | 282 | } | |
| 3266 |
3/4✓ Branch 0 taken 196 times.
✓ Branch 1 taken 168 times.
✓ Branch 2 taken 196 times.
✗ Branch 3 not taken.
|
282 | if ( tempheader.zelda_version < 0x255 || (tempheader.zelda_version == 0x255 && tempheader.build < 49) ) |
| 3267 | { | ||
| 3268 |
2/2✓ Branch 0 taken 282 times.
✓ Branch 1 taken 82 times.
|
364 | set_qr(qr_NO_OVERWRITING_HOPPING,1); |
| 3269 | 282 | } | |
| 3270 |
3/4✓ Branch 0 taken 196 times.
✓ Branch 1 taken 168 times.
✓ Branch 2 taken 196 times.
✗ Branch 3 not taken.
|
282 | if ( tempheader.zelda_version < 0x255 || (tempheader.zelda_version == 0x255 && tempheader.build < 50) ) |
| 3271 | { | ||
| 3272 |
2/2✓ Branch 0 taken 282 times.
✓ Branch 1 taken 82 times.
|
364 | set_qr(qr_STRING_FRAME_OLD_WIDTH_HEIGHT,1); |
| 3273 | 282 | } | |
| 3274 |
3/4✓ Branch 0 taken 196 times.
✓ Branch 1 taken 168 times.
✓ Branch 2 taken 196 times.
✗ Branch 3 not taken.
|
282 | if ( tempheader.zelda_version < 0x255 || (tempheader.zelda_version == 0x255 && tempheader.build < 53) ) |
| 3275 | { | ||
| 3276 |
2/2✓ Branch 0 taken 282 times.
✓ Branch 1 taken 82 times.
|
364 | set_qr(qr_BROKEN_OVERWORLD_MINIMAP,1); |
| 3277 | 282 | } | |
| 3278 | //} | ||
| 3279 | |||
| 3280 |
1/2✓ Branch 0 taken 282 times.
✗ Branch 1 not taken.
|
282 | if(compatrule_version < 1) //Enemies->Secret only affects flag 16-31 |
| 3281 |
1/2✓ Branch 0 taken 282 times.
✗ Branch 1 not taken.
|
282 | set_qr(qr_ENEMIES_SECRET_ONLY_16_31,1); |
| 3282 | |||
| 3283 |
1/2✓ Branch 0 taken 282 times.
✗ Branch 1 not taken.
|
282 | if(compatrule_version < 2) //Old CSet2 Handling |
| 3284 |
1/2✓ Branch 0 taken 282 times.
✗ Branch 1 not taken.
|
282 | set_qr(qr_OLDCS2,1); |
| 3285 | |||
| 3286 |
1/2✓ Branch 0 taken 282 times.
✗ Branch 1 not taken.
|
282 | if(compatrule_version < 3) //Hardcoded Shadow/Spawn/Death anim frames |
| 3287 |
1/2✓ Branch 0 taken 282 times.
✗ Branch 1 not taken.
|
282 | set_qr(qr_HARDCODED_ENEMY_ANIMS,1); |
| 3288 | |||
| 3289 |
1/2✓ Branch 0 taken 282 times.
✗ Branch 1 not taken.
|
282 | if(compatrule_version < 4) //Hardcoded Shadow/Spawn/Death anim frames |
| 3290 |
1/2✓ Branch 0 taken 282 times.
✗ Branch 1 not taken.
|
282 | set_qr(qr_OLD_ITEMDATA_SCRIPT_TIMING,1); |
| 3291 | |||
| 3292 |
3/4✓ Branch 0 taken 282 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 200 times.
✓ Branch 3 taken 82 times.
|
282 | if(compatrule_version < 5 && tempheader.zelda_version >= 0x250) //Hardcoded Shadow/Spawn/Death anim frames |
| 3293 |
1/2✓ Branch 0 taken 200 times.
✗ Branch 1 not taken.
|
200 | set_qr(qr_NO_LANMOLA_RINGLEADER,1); |
| 3294 | |||
| 3295 |
1/2✓ Branch 0 taken 282 times.
✗ Branch 1 not taken.
|
282 | if(compatrule_version < 6) //Step->Secret (Temp) only affects flag 16-31 |
| 3296 |
1/2✓ Branch 0 taken 282 times.
✗ Branch 1 not taken.
|
282 | set_qr(qr_STEPTEMP_SECRET_ONLY_16_31,1); |
| 3297 | |||
| 3298 |
1/2✓ Branch 0 taken 282 times.
✗ Branch 1 not taken.
|
282 | if(compatrule_version < 7) //'Hit All Triggers->Perm Secret' doesn't trigger temp secrets |
| 3299 |
1/2✓ Branch 0 taken 282 times.
✗ Branch 1 not taken.
|
282 | set_qr(qr_ALLTRIG_PERMSEC_NO_TEMP,1); |
| 3300 | |||
| 3301 |
1/2✓ Branch 0 taken 282 times.
✗ Branch 1 not taken.
|
282 | if(compatrule_version < 8) //Hardcoded LItem/Bomb/Clock/Magic Tile Mods |
| 3302 |
1/2✓ Branch 0 taken 282 times.
✗ Branch 1 not taken.
|
282 | set_qr(qr_HARDCODED_LITEM_LTMS,1); |
| 3303 | |||
| 3304 |
1/2✓ Branch 0 taken 282 times.
✗ Branch 1 not taken.
|
282 | if(compatrule_version < 9) |
| 3305 | { | ||
| 3306 | //Hardcoded BS Patras | ||
| 3307 |
1/2✓ Branch 0 taken 282 times.
✗ Branch 1 not taken.
|
282 | set_qr(qr_HARDCODED_BS_PATRA,1); |
| 3308 | //Hardcoded Patra Inner Eye offsets | ||
| 3309 |
1/2✓ Branch 0 taken 282 times.
✗ Branch 1 not taken.
|
282 | set_qr(qr_PATRAS_USE_HARDCODED_OFFSETS,1); |
| 3310 | //Broken 'Big enemy' animation style | ||
| 3311 |
1/2✓ Branch 0 taken 282 times.
✗ Branch 1 not taken.
|
282 | set_qr(qr_BROKEN_BIG_ENEMY_ANIMATION,1); |
| 3312 | //Broken Attribute 31/32 | ||
| 3313 |
1/2✓ Branch 0 taken 282 times.
✗ Branch 1 not taken.
|
282 | set_qr(qr_BROKEN_ATTRIBUTE_31_32,1); |
| 3314 | 282 | } | |
| 3315 | |||
| 3316 |
1/2✓ Branch 0 taken 282 times.
✗ Branch 1 not taken.
|
282 | if(compatrule_version < 10) //Shared candle use limits |
| 3317 |
1/2✓ Branch 0 taken 282 times.
✗ Branch 1 not taken.
|
282 | set_qr(qr_CANDLES_SHARED_LIMIT,1); |
| 3318 | |||
| 3319 |
1/2✓ Branch 0 taken 282 times.
✗ Branch 1 not taken.
|
282 | if(compatrule_version < 11) //No cross-screen return points |
| 3320 |
1/2✓ Branch 0 taken 282 times.
✗ Branch 1 not taken.
|
282 | set_qr(qr_OLD_RESPAWN_POINTS,1); |
| 3321 | |||
| 3322 |
1/2✓ Branch 0 taken 282 times.
✗ Branch 1 not taken.
|
282 | if(compatrule_version < 12) |
| 3323 | { | ||
| 3324 | //Old fire trail duration | ||
| 3325 |
1/2✓ Branch 0 taken 282 times.
✗ Branch 1 not taken.
|
282 | set_qr(qr_OLD_FLAMETRAIL_DURATION,1); |
| 3326 | //Old Intro String in Ganon Room Behavior | ||
| 3327 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 282 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
282 | if(get_qr(qr_GANONINTRO)) set_qr(qr_GANONINTRO,0); |
| 3328 |
1/2✓ Branch 0 taken 282 times.
✗ Branch 1 not taken.
|
282 | else set_qr(qr_GANONINTRO,1); |
| 3329 | 282 | } | |
| 3330 | |||
| 3331 |
2/4✓ Branch 0 taken 282 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 282 times.
|
282 | if(compatrule_version < 13 && tempheader.zelda_version >= 0x255) //ANone doesn't reset to originaltile |
| 3332 | ✗ | set_qr(qr_ANONE_NOANIM,1); | |
| 3333 | |||
| 3334 |
1/2✓ Branch 0 taken 282 times.
✗ Branch 1 not taken.
|
282 | if(compatrule_version < 14) //Old Bridge Combo Behavior |
| 3335 |
1/2✓ Branch 0 taken 282 times.
✗ Branch 1 not taken.
|
282 | set_qr(qr_OLD_BRIDGE_COMBOS,1); |
| 3336 | |||
| 3337 |
1/2✓ Branch 0 taken 282 times.
✗ Branch 1 not taken.
|
282 | if(compatrule_version < 15) //Broken Z3 Animation |
| 3338 |
1/2✓ Branch 0 taken 282 times.
✗ Branch 1 not taken.
|
282 | set_qr(qr_BROKEN_Z3_ANIMATION,1); |
| 3339 | |||
| 3340 |
1/2✓ Branch 0 taken 282 times.
✗ Branch 1 not taken.
|
282 | if(compatrule_version < 16) //Old Enemy Tile Behavior with Animation (None) Enemies |
| 3341 |
1/2✓ Branch 0 taken 282 times.
✗ Branch 1 not taken.
|
282 | set_qr(qr_OLD_TILE_INITIALIZATION,1); |
| 3342 | |||
| 3343 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 282 times.
|
282 | if(compatrule_version < 17) |
| 3344 | { | ||
| 3345 | //Old Quake/DrawYOffset behavior | ||
| 3346 | //set_qr(qr_OLD_DRAWOFFSET,1); | ||
| 3347 | //I'm leaving this commented cause I doubt it'll break anything and I think the bugfix might be appreciated in older versions. | ||
| 3348 | //On the offchance that it *does* break old quests, fixing it is as simple as uncommenting the set_bit above. | ||
| 3349 | 282 | } | |
| 3350 | |||
| 3351 |
1/2✓ Branch 0 taken 282 times.
✗ Branch 1 not taken.
|
282 | if(compatrule_version < 18) |
| 3352 | { | ||
| 3353 | //Broken DrawScreen Derivative Functions | ||
| 3354 |
1/2✓ Branch 0 taken 282 times.
✗ Branch 1 not taken.
|
282 | set_qr(qr_BROKEN_DRAWSCREEN_FUNCTIONS,1); |
| 3355 | //Scrolling Cancels Charge | ||
| 3356 |
1/2✓ Branch 0 taken 282 times.
✗ Branch 1 not taken.
|
282 | set_qr(qr_SCROLLING_KILLS_CHARGE,1); |
| 3357 | 282 | } | |
| 3358 | |||
| 3359 |
1/2✓ Branch 0 taken 282 times.
✗ Branch 1 not taken.
|
282 | if(compatrule_version < 19) //Broken Enemy Item Carrying with Large Enemies |
| 3360 |
1/2✓ Branch 0 taken 282 times.
✗ Branch 1 not taken.
|
282 | set_qr(qr_BROKEN_ITEM_CARRYING,1); |
| 3361 | |||
| 3362 |
1/2✓ Branch 0 taken 282 times.
✗ Branch 1 not taken.
|
282 | if(compatrule_version < 20) |
| 3363 |
1/2✓ Branch 0 taken 282 times.
✗ Branch 1 not taken.
|
282 | set_qr(qr_CUSTOMWEAPON_IGNORE_COST,1); |
| 3364 | |||
| 3365 |
1/2✓ Branch 0 taken 282 times.
✗ Branch 1 not taken.
|
282 | if(compatrule_version < 21) |
| 3366 | { | ||
| 3367 |
1/2✓ Branch 0 taken 282 times.
✗ Branch 1 not taken.
|
282 | set_qr(qr_LEEVERS_DONT_OBEY_STUN,1); |
| 3368 |
1/2✓ Branch 0 taken 282 times.
✗ Branch 1 not taken.
|
282 | set_qr(qr_GANON_CANT_SPAWN_ON_CONTINUE,1); |
| 3369 |
1/2✓ Branch 0 taken 282 times.
✗ Branch 1 not taken.
|
282 | set_qr(qr_WIZZROBES_DONT_OBEY_STUN,1); |
| 3370 |
1/2✓ Branch 0 taken 282 times.
✗ Branch 1 not taken.
|
282 | set_qr(qr_OLD_BUG_NET,1); |
| 3371 |
1/2✓ Branch 0 taken 282 times.
✗ Branch 1 not taken.
|
282 | set_qr(qr_MANHANDLA_BLOCK_SFX,1); |
| 3372 | 282 | } | |
| 3373 | |||
| 3374 |
1/2✓ Branch 0 taken 282 times.
✗ Branch 1 not taken.
|
282 | if(compatrule_version < 22) |
| 3375 |
1/2✓ Branch 0 taken 282 times.
✗ Branch 1 not taken.
|
282 | set_qr(qr_BROKEN_KEEPOLD_FLAG,1); |
| 3376 | |||
| 3377 |
1/2✓ Branch 0 taken 282 times.
✗ Branch 1 not taken.
|
282 | if(compatrule_version < 23) |
| 3378 |
1/2✓ Branch 0 taken 282 times.
✗ Branch 1 not taken.
|
282 | set_qr(qr_OLD_HALF_MAGIC,1); |
| 3379 | |||
| 3380 |
1/2✓ Branch 0 taken 282 times.
✗ Branch 1 not taken.
|
282 | if(compatrule_version < 24) |
| 3381 | { | ||
| 3382 |
1/2✓ Branch 0 taken 282 times.
✗ Branch 1 not taken.
|
282 | set_qr(qr_WARPS_RESTART_DMAPSCRIPT,1); |
| 3383 |
1/2✓ Branch 0 taken 282 times.
✗ Branch 1 not taken.
|
282 | set_qr(qr_DMAP_0_CONTINUE_BUG,1); |
| 3384 | 282 | } | |
| 3385 | |||
| 3386 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 282 times.
|
282 | if(compatrule_version < 25) |
| 3387 | { | ||
| 3388 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 282 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
282 | if (get_qr(qr_OLD_FAIRY_LIMIT)) set_qr(qr_OLD_FAIRY_LIMIT,0); |
| 3389 |
1/2✓ Branch 0 taken 282 times.
✗ Branch 1 not taken.
|
282 | else set_qr(qr_OLD_FAIRY_LIMIT,1); |
| 3390 |
1/2✓ Branch 0 taken 282 times.
✗ Branch 1 not taken.
|
282 | set_qr(qr_OLD_SCRIPTED_KNOCKBACK,1); |
| 3391 | 282 | } | |
| 3392 |
1/2✓ Branch 0 taken 282 times.
✗ Branch 1 not taken.
|
282 | if(compatrule_version < 26) |
| 3393 | { | ||
| 3394 |
1/2✓ Branch 0 taken 282 times.
✗ Branch 1 not taken.
|
282 | set_qr(qr_OLD_KEESE_Z_AXIS,1); |
| 3395 |
1/2✓ Branch 0 taken 282 times.
✗ Branch 1 not taken.
|
282 | set_qr(qr_POLVIRE_NO_SHADOW,1); |
| 3396 |
1/2✓ Branch 0 taken 282 times.
✗ Branch 1 not taken.
|
282 | set_qr(qr_SUBSCR_OLD_SELECTOR,1); |
| 3397 | 282 | } | |
| 3398 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 282 times.
|
282 | if(compatrule_version < 27) //Noticed some junk data in the QR array... |
| 3399 | { | ||
| 3400 |
2/2✓ Branch 0 taken 84882 times.
✓ Branch 1 taken 282 times.
|
85164 | for(auto q = qr_POLVIRE_NO_SHADOW+1; q < qr_PARSER_250DIVISION; ++q) |
| 3401 |
1/2✓ Branch 0 taken 84882 times.
✗ Branch 1 not taken.
|
84882 | set_qr(q,0); |
| 3402 |
2/2✓ Branch 0 taken 1692 times.
✓ Branch 1 taken 282 times.
|
1974 | for(auto q = qr_COMBODATA_INITD_MULT_TENK+1; q < qr_MAX; ++q) |
| 3403 |
1/2✓ Branch 0 taken 1692 times.
✗ Branch 1 not taken.
|
1692 | set_qr(q,0); |
| 3404 | //This should nuke any remaining junk data... not sure if it affected anything previous. -Em | ||
| 3405 | 282 | } | |
| 3406 |
2/2✓ Branch 0 taken 286 times.
✓ Branch 1 taken 4 times.
|
282 | if(compatrule_version < 28) |
| 3407 |
1/2✓ Branch 0 taken 286 times.
✗ Branch 1 not taken.
|
286 | set_qr(qr_SUBSCR_BACKWARDS_ID_ORDER,1); |
| 3408 |
2/2✓ Branch 0 taken 286 times.
✓ Branch 1 taken 4 times.
|
290 | if(compatrule_version < 29) |
| 3409 |
1/2✓ Branch 0 taken 286 times.
✗ Branch 1 not taken.
|
286 | set_qr(qr_OLD_LOCKBLOCK_COLLISION,1); |
| 3410 |
2/2✓ Branch 0 taken 286 times.
✓ Branch 1 taken 4 times.
|
290 | if(compatrule_version < 30) |
| 3411 | { | ||
| 3412 |
1/2✓ Branch 0 taken 286 times.
✗ Branch 1 not taken.
|
286 | set_qr(qr_DECO_2_YOFFSET,1); |
| 3413 |
1/2✓ Branch 0 taken 286 times.
✗ Branch 1 not taken.
|
286 | set_qr(qr_SCREENSTATE_80s_BUG,1); |
| 3414 | 286 | } | |
| 3415 |
2/2✓ Branch 0 taken 286 times.
✓ Branch 1 taken 4 times.
|
290 | if(compatrule_version < 31) |
| 3416 | { | ||
| 3417 |
1/2✓ Branch 0 taken 286 times.
✗ Branch 1 not taken.
|
286 | set_qr(qr_GOHMA_UNDAMAGED_BUG,1); |
| 3418 |
1/2✓ Branch 0 taken 286 times.
✗ Branch 1 not taken.
|
286 | set_qr(qr_FFCPRELOAD_BUGGED_LOAD,1); |
| 3419 | 286 | } | |
| 3420 |
2/2✓ Branch 0 taken 286 times.
✓ Branch 1 taken 4 times.
|
290 | if(compatrule_version < 32) |
| 3421 |
1/2✓ Branch 0 taken 286 times.
✗ Branch 1 not taken.
|
286 | set_qr(qr_BROKEN_GETPIXEL_VALUE,1); |
| 3422 |
2/2✓ Branch 0 taken 286 times.
✓ Branch 1 taken 4 times.
|
290 | if(compatrule_version < 33) |
| 3423 |
1/2✓ Branch 0 taken 286 times.
✗ Branch 1 not taken.
|
286 | set_qr(qr_NO_LIFT_SPRITE,1); |
| 3424 |
2/2✓ Branch 0 taken 286 times.
✓ Branch 1 taken 4 times.
|
290 | if(compatrule_version < 34) |
| 3425 | { | ||
| 3426 |
1/2✓ Branch 0 taken 286 times.
✗ Branch 1 not taken.
|
286 | set_qr(qr_OLD_SIDEVIEW_LANDING_CODE,1); |
| 3427 |
1/2✓ Branch 0 taken 286 times.
✗ Branch 1 not taken.
|
286 | set_qr(qr_OLD_FFC_SPEED_CAP,1); |
| 3428 |
1/2✓ Branch 0 taken 286 times.
✗ Branch 1 not taken.
|
286 | set_qr(qr_OLD_FFC_FUNCTIONALITY,1); |
| 3429 |
1/2✓ Branch 0 taken 286 times.
✗ Branch 1 not taken.
|
286 | set_qr(qr_OLD_WIZZROBE_SUBMERGING,1); |
| 3430 | 286 | } | |
| 3431 |
2/2✓ Branch 0 taken 288 times.
✓ Branch 1 taken 4 times.
|
290 | if(compatrule_version < 35) |
| 3432 | { | ||
| 3433 |
1/2✓ Branch 0 taken 288 times.
✗ Branch 1 not taken.
|
288 | set_qr(qr_ZS_NO_NEG_ARRAY,1); |
| 3434 |
1/2✓ Branch 0 taken 288 times.
✗ Branch 1 not taken.
|
288 | set_qr(qr_BROKEN_INPUT_DOWN_STATE,1); |
| 3435 | 288 | } | |
| 3436 |
2/2✓ Branch 0 taken 288 times.
✓ Branch 1 taken 4 times.
|
292 | if(compatrule_version < 36) |
| 3437 |
1/2✓ Branch 0 taken 288 times.
✗ Branch 1 not taken.
|
288 | set_qr(qr_OLD_SHALLOW_SFX,1); |
| 3438 |
1/2✓ Branch 0 taken 292 times.
✗ Branch 1 not taken.
|
292 | if(compatrule_version < 37) |
| 3439 |
1/2✓ Branch 0 taken 292 times.
✗ Branch 1 not taken.
|
292 | set_qr(qr_SPARKLES_INHERIT_PROPERTIES,1); |
| 3440 |
1/2✓ Branch 0 taken 292 times.
✗ Branch 1 not taken.
|
292 | if(compatrule_version < 38) |
| 3441 |
1/2✓ Branch 0 taken 292 times.
✗ Branch 1 not taken.
|
292 | set_qr(qr_BUGGED_LAYERED_FLAGS,1); |
| 3442 |
1/2✓ Branch 0 taken 292 times.
✗ Branch 1 not taken.
|
292 | if(compatrule_version < 39) |
| 3443 |
1/2✓ Branch 0 taken 292 times.
✗ Branch 1 not taken.
|
292 | set_qr(qr_HARDCODED_FFC_BUSH_DROPS,1); |
| 3444 |
1/2✓ Branch 0 taken 292 times.
✗ Branch 1 not taken.
|
292 | if(compatrule_version < 40) |
| 3445 |
1/2✓ Branch 0 taken 292 times.
✗ Branch 1 not taken.
|
292 | set_qr(qr_MOVINGBLOCK_FAKE_SOLID,1); |
| 3446 |
2/2✓ Branch 0 taken 294 times.
✓ Branch 1 taken 2 times.
|
292 | if(compatrule_version < 41) |
| 3447 |
1/2✓ Branch 0 taken 294 times.
✗ Branch 1 not taken.
|
294 | set_qr(qr_BROKENHITBY,1); |
| 3448 |
2/2✓ Branch 0 taken 294 times.
✓ Branch 1 taken 2 times.
|
296 | if(compatrule_version < 42) |
| 3449 |
1/2✓ Branch 0 taken 294 times.
✗ Branch 1 not taken.
|
294 | set_qr(qr_BROKEN_MOVING_BOMBS,1); |
| 3450 |
2/2✓ Branch 0 taken 294 times.
✓ Branch 1 taken 2 times.
|
296 | if(compatrule_version < 43) |
| 3451 |
1/2✓ Branch 0 taken 294 times.
✗ Branch 1 not taken.
|
294 | set_qr(qr_OLD_BOMB_HITBOXES,1); |
| 3452 |
2/2✓ Branch 0 taken 294 times.
✓ Branch 1 taken 2 times.
|
296 | if(compatrule_version < 44) |
| 3453 |
1/2✓ Branch 0 taken 294 times.
✗ Branch 1 not taken.
|
294 | set_qr(qr_SCROLLWARP_NO_RESET_FRAME,1); |
| 3454 |
2/2✓ Branch 0 taken 294 times.
✓ Branch 1 taken 2 times.
|
296 | if(compatrule_version < 45) |
| 3455 |
1/2✓ Branch 0 taken 294 times.
✗ Branch 1 not taken.
|
294 | set_qr(qr_ENEMIES_DONT_SCRIPT_FIRST_FRAME,1); |
| 3456 |
2/2✓ Branch 0 taken 294 times.
✓ Branch 1 taken 2 times.
|
296 | if(compatrule_version < 46) |
| 3457 |
1/2✓ Branch 0 taken 294 times.
✗ Branch 1 not taken.
|
294 | set_qr(qr_BROKEN_RAFT_SCROLL,1); |
| 3458 |
2/2✓ Branch 0 taken 298 times.
✓ Branch 1 taken 2 times.
|
296 | if(compatrule_version < 47) |
| 3459 | { | ||
| 3460 |
1/2✓ Branch 0 taken 298 times.
✗ Branch 1 not taken.
|
298 | set_qr(qr_SENSITIVE_SOLID_DAMAGE,1); |
| 3461 |
1/2✓ Branch 0 taken 298 times.
✗ Branch 1 not taken.
|
298 | set_qr(qr_OLD_CONVEYOR_COLLISION,1); |
| 3462 | 298 | } | |
| 3463 |
2/2✓ Branch 0 taken 298 times.
✓ Branch 1 taken 2 times.
|
300 | if(compatrule_version < 48) |
| 3464 |
1/2✓ Branch 0 taken 298 times.
✗ Branch 1 not taken.
|
298 | set_qr(qr_OLD_GUY_HANDLING,1); |
| 3465 |
2/2✓ Branch 0 taken 298 times.
✓ Branch 1 taken 2 times.
|
300 | if(compatrule_version < 49) |
| 3466 |
1/2✓ Branch 0 taken 298 times.
✗ Branch 1 not taken.
|
298 | set_qr(qr_FAIRY_FLAG_COMPAT,1); |
| 3467 |
2/2✓ Branch 0 taken 298 times.
✓ Branch 1 taken 2 times.
|
300 | if(compatrule_version < 50) |
| 3468 |
1/2✓ Branch 0 taken 298 times.
✗ Branch 1 not taken.
|
298 | set_qr(qr_OLD_LENS_LAYEREFFECT,1); |
| 3469 |
2/2✓ Branch 0 taken 298 times.
✓ Branch 1 taken 2 times.
|
300 | if(compatrule_version < 51) |
| 3470 |
1/2✓ Branch 0 taken 298 times.
✗ Branch 1 not taken.
|
298 | set_qr(qr_PUSHBLOCK_SPRITE_LAYER,1); |
| 3471 |
2/2✓ Branch 0 taken 298 times.
✓ Branch 1 taken 2 times.
|
300 | if (compatrule_version < 52) |
| 3472 |
1/2✓ Branch 0 taken 298 times.
✗ Branch 1 not taken.
|
298 | set_qr(qr_OLD_SCRIPT_VOLUME, 1); |
| 3473 |
2/2✓ Branch 0 taken 298 times.
✓ Branch 1 taken 2 times.
|
300 | if(compatrule_version < 53) |
| 3474 | { | ||
| 3475 |
1/2✓ Branch 0 taken 298 times.
✗ Branch 1 not taken.
|
298 | set_qr(qr_OLD_SUBSCR,1); |
| 3476 |
1/2✓ Branch 0 taken 298 times.
✗ Branch 1 not taken.
|
298 | set_qr(qr_ITM_0_INVIS_ON_BTNS,1); |
| 3477 |
1/2✓ Branch 0 taken 298 times.
✗ Branch 1 not taken.
|
298 | set_qr(qr_OLD_GAUGE_TILE_LAYOUT,1); |
| 3478 | 298 | } | |
| 3479 |
2/2✓ Branch 0 taken 298 times.
✓ Branch 1 taken 2 times.
|
300 | if(compatrule_version < 54) |
| 3480 |
1/2✓ Branch 0 taken 298 times.
✗ Branch 1 not taken.
|
298 | set_qr(qr_WALKTHROUGHWALL_NO_DOORSTATE,1); |
| 3481 |
2/2✓ Branch 0 taken 298 times.
✓ Branch 1 taken 2 times.
|
300 | if(compatrule_version < 55) |
| 3482 |
1/2✓ Branch 0 taken 298 times.
✗ Branch 1 not taken.
|
298 | set_qr(qr_SPOTLIGHT_IGNR_SOLIDOBJ,1); |
| 3483 |
2/2✓ Branch 0 taken 298 times.
✓ Branch 1 taken 2 times.
|
300 | if(compatrule_version < 56) |
| 3484 |
1/2✓ Branch 0 taken 298 times.
✗ Branch 1 not taken.
|
298 | set_qr(qr_BROKEN_LIGHTBEAM_HITBOX,1); |
| 3485 |
2/2✓ Branch 0 taken 298 times.
✓ Branch 1 taken 2 times.
|
300 | if(compatrule_version < 57) |
| 3486 |
1/2✓ Branch 0 taken 298 times.
✗ Branch 1 not taken.
|
298 | set_qr(qr_BROKEN_SWORD_SPIN_TRIGGERS,1); |
| 3487 |
2/2✓ Branch 0 taken 298 times.
✓ Branch 1 taken 2 times.
|
300 | if(compatrule_version < 58) |
| 3488 |
1/2✓ Branch 0 taken 298 times.
✗ Branch 1 not taken.
|
298 | set_qr(qr_OLD_DMAP_INTRO_STRINGS,1); |
| 3489 |
2/2✓ Branch 0 taken 298 times.
✓ Branch 1 taken 2 times.
|
300 | if(compatrule_version < 59) |
| 3490 |
1/2✓ Branch 0 taken 298 times.
✗ Branch 1 not taken.
|
298 | set_qr(qr_SCRIPT_CONTHP_IS_HEARTS,1); |
| 3491 |
2/2✓ Branch 0 taken 298 times.
✓ Branch 1 taken 2 times.
|
300 | if(compatrule_version < 60) |
| 3492 |
1/2✓ Branch 0 taken 298 times.
✗ Branch 1 not taken.
|
298 | set_qr(qr_SEPARATE_BOMBABLE_TAPPING_SFX,1); |
| 3493 |
2/2✓ Branch 0 taken 298 times.
✓ Branch 1 taken 2 times.
|
300 | if(compatrule_version < 61) |
| 3494 |
1/2✓ Branch 0 taken 298 times.
✗ Branch 1 not taken.
|
298 | set_qr(qr_BROKEN_BOMB_AMMO_COSTS,1); |
| 3495 |
2/2✓ Branch 0 taken 298 times.
✓ Branch 1 taken 2 times.
|
300 | if(compatrule_version < 62) |
| 3496 |
1/2✓ Branch 0 taken 298 times.
✗ Branch 1 not taken.
|
298 | set_qr(qr_OLD_BROKEN_WARPEX_MUSIC,1); |
| 3497 |
2/2✓ Branch 0 taken 299 times.
✓ Branch 1 taken 1 times.
|
300 | if(compatrule_version < 63) |
| 3498 | { | ||
| 3499 |
1/2✓ Branch 0 taken 299 times.
✗ Branch 1 not taken.
|
299 | set_qr(qr_BROKEN_LIFTSWIM,1); |
| 3500 |
1/2✓ Branch 0 taken 299 times.
✗ Branch 1 not taken.
|
299 | set_qr(qr_BROKEN_GENERIC_PUSHBLOCK_LOCKING,1); |
| 3501 | 299 | } | |
| 3502 |
2/2✓ Branch 0 taken 299 times.
✓ Branch 1 taken 1 times.
|
300 | if(compatrule_version < 64) |
| 3503 |
1/2✓ Branch 0 taken 299 times.
✗ Branch 1 not taken.
|
299 | set_qr(qr_BROKEN_FLAME_ARROW_REFLECTING,1); |
| 3504 |
2/2✓ Branch 0 taken 324 times.
✓ Branch 1 taken 24 times.
|
300 | if(compatrule_version < 65) |
| 3505 |
1/2✓ Branch 0 taken 324 times.
✗ Branch 1 not taken.
|
324 | set_qr(qr_BROKEN_SIDEVIEW_SPRITE_JUMP,1); |
| 3506 |
2/2✓ Branch 0 taken 326 times.
✓ Branch 1 taken 24 times.
|
348 | if(compatrule_version < 66) |
| 3507 |
1/2✓ Branch 0 taken 326 times.
✗ Branch 1 not taken.
|
326 | set_qr(qr_NEWDARK_TRANS_STACKING,1); |
| 3508 |
2/2✓ Branch 0 taken 326 times.
✓ Branch 1 taken 24 times.
|
350 | if(compatrule_version < 67) |
| 3509 |
1/2✓ Branch 0 taken 326 times.
✗ Branch 1 not taken.
|
326 | set_qr(qr_OLD_HERO_WARP_RETSQUARE,1); |
| 3510 |
2/2✓ Branch 0 taken 326 times.
✓ Branch 1 taken 24 times.
|
350 | if(compatrule_version < 68) |
| 3511 |
1/2✓ Branch 0 taken 326 times.
✗ Branch 1 not taken.
|
326 | set_qr(qr_SCRIPTS_6_BIT_COLOR,1); |
| 3512 |
2/2✓ Branch 0 taken 326 times.
✓ Branch 1 taken 24 times.
|
350 | if(compatrule_version < 69) |
| 3513 |
1/2✓ Branch 0 taken 326 times.
✗ Branch 1 not taken.
|
326 | set_qr(qr_SETENEMYWEAPONSOUNDSONWPNCHANGE, 1); |
| 3514 |
2/2✓ Branch 0 taken 326 times.
✓ Branch 1 taken 24 times.
|
350 | if (compatrule_version < 70) |
| 3515 |
1/2✓ Branch 0 taken 326 times.
✗ Branch 1 not taken.
|
326 | set_qr(qr_BROKEN_CONVEYORS, 1); |
| 3516 |
2/2✓ Branch 0 taken 326 times.
✓ Branch 1 taken 24 times.
|
350 | if (compatrule_version < 71) |
| 3517 |
1/2✓ Branch 0 taken 326 times.
✗ Branch 1 not taken.
|
326 | set_qr(qr_BROKEN_PUSHBLOCK_TOP_HALF_SOLIDS, 1); |
| 3518 |
2/2✓ Branch 0 taken 326 times.
✓ Branch 1 taken 24 times.
|
350 | if (compatrule_version < 72) |
| 3519 |
1/2✓ Branch 0 taken 326 times.
✗ Branch 1 not taken.
|
326 | set_qr(qr_BROKEN_PUSHBLOCK_FLAG_CLONING, 1); |
| 3520 |
2/2✓ Branch 0 taken 326 times.
✓ Branch 1 taken 24 times.
|
350 | if (compatrule_version < 73) |
| 3521 | { | ||
| 3522 |
1/2✓ Branch 0 taken 326 times.
✗ Branch 1 not taken.
|
326 | set_qr(qr_OLD_LANDING_SFX, 1); |
| 3523 |
1/2✓ Branch 0 taken 326 times.
✗ Branch 1 not taken.
|
326 | set_qr(qr_FIRE_LEVEL_TRIGGERS_ARENT_WEAPONS, 1); |
| 3524 | 326 | } | |
| 3525 |
5/6✓ Branch 0 taken 326 times.
✓ Branch 1 taken 24 times.
✓ Branch 2 taken 325 times.
✓ Branch 3 taken 1 times.
✓ Branch 4 taken 325 times.
✗ Branch 5 not taken.
|
350 | if (compatrule_version < 74 && (tempheader.version_major >= 3 || tempheader.compareVer(2, 55, 9) < 0)) |
| 3526 |
2/2✓ Branch 0 taken 326 times.
✓ Branch 1 taken 325 times.
|
1 | set_qr(qr_BROKEN_SCRIPTS_SCROLLING_HERO_POSITION, 1); |
| 3527 |
5/6✓ Branch 0 taken 326 times.
✓ Branch 1 taken 349 times.
✓ Branch 2 taken 325 times.
✓ Branch 3 taken 1 times.
✓ Branch 4 taken 325 times.
✗ Branch 5 not taken.
|
675 | if (compatrule_version < 75 && (tempheader.version_major >= 3 || tempheader.compareVer(2, 55, 10) < 0)) |
| 3528 |
2/2✓ Branch 0 taken 326 times.
✓ Branch 1 taken 325 times.
|
1 | set_qr(qr_BROKEN_SCRIPTS_BITMAP_DRAW_ORIGIN, 1); |
| 3529 |
5/6✓ Branch 0 taken 326 times.
✓ Branch 1 taken 674 times.
✓ Branch 2 taken 325 times.
✓ Branch 3 taken 1 times.
✓ Branch 4 taken 325 times.
✗ Branch 5 not taken.
|
1000 | if (compatrule_version < 76 && (tempheader.version_major >= 3 || tempheader.compareVer(2, 55, 10) < 0)) |
| 3530 |
2/2✓ Branch 0 taken 326 times.
✓ Branch 1 taken 325 times.
|
1 | set_qr(qr_INVERTED_DARK_COMBO_TRIGGERS, 1); |
| 3531 |
2/2✓ Branch 0 taken 344 times.
✓ Branch 1 taken 981 times.
|
1325 | if (compatrule_version < 77) |
| 3532 |
1/2✓ Branch 0 taken 344 times.
✗ Branch 1 not taken.
|
344 | set_qr(qr_BROKEN_ICY_FLOOR_SIDEVIEW, 1); |
| 3533 |
2/2✓ Branch 0 taken 344 times.
✓ Branch 1 taken 981 times.
|
1325 | if (compatrule_version < 78) |
| 3534 |
1/2✓ Branch 0 taken 344 times.
✗ Branch 1 not taken.
|
344 | set_qr(qr_SCRIPTS_SCREEN_DRAW_LIGHT_NO_OFFSET, 1); |
| 3535 |
2/2✓ Branch 0 taken 344 times.
✓ Branch 1 taken 981 times.
|
1325 | if (compatrule_version < 79) |
| 3536 |
1/2✓ Branch 0 taken 344 times.
✗ Branch 1 not taken.
|
344 | set_qr(qr_BROKEN_SYSTEM_COLORS, 1); |
| 3537 |
2/2✓ Branch 0 taken 345 times.
✓ Branch 1 taken 980 times.
|
1325 | if (compatrule_version < 80) |
| 3538 |
1/2✓ Branch 0 taken 345 times.
✗ Branch 1 not taken.
|
345 | set_qr(qr_ZS_OLD_SUSPEND_FFC, 1); |
| 3539 |
5/6✓ Branch 0 taken 351 times.
✓ Branch 1 taken 974 times.
✓ Branch 2 taken 325 times.
✓ Branch 3 taken 26 times.
✓ Branch 4 taken 325 times.
✗ Branch 5 not taken.
|
1325 | if (compatrule_version < 81 && (tempheader.version_major >= 3 || tempheader.compareVer(2, 55, 10) < 0)) |
| 3540 |
2/2✓ Branch 0 taken 351 times.
✓ Branch 1 taken 325 times.
|
26 | set_qr(qr_BROKEN_SCROLL_INSTEAD_OF_DROWN_FALL, 1); |
| 3541 |
5/6✓ Branch 0 taken 351 times.
✓ Branch 1 taken 1299 times.
✓ Branch 2 taken 325 times.
✓ Branch 3 taken 26 times.
✓ Branch 4 taken 325 times.
✗ Branch 5 not taken.
|
1650 | if (compatrule_version < 81 && (tempheader.version_major >= 3 || tempheader.compareVer(2, 55, 6) < 0)) |
| 3542 |
2/2✓ Branch 0 taken 351 times.
✓ Branch 1 taken 325 times.
|
26 | set_qr(qr_ROPE_ENEMIES_SPEED_NOT_CONFIGURABLE, 1); |
| 3543 |
2/2✓ Branch 0 taken 351 times.
✓ Branch 1 taken 1624 times.
|
1975 | if (compatrule_version < 82) |
| 3544 | { | ||
| 3545 |
1/2✓ Branch 0 taken 351 times.
✗ Branch 1 not taken.
|
351 | set_qr(qr_EW_ROCKS_HARDCODED_BREAK_ON_SOLID, 1); |
| 3546 |
1/2✓ Branch 0 taken 351 times.
✗ Branch 1 not taken.
|
351 | set_qr(qr_IMPRECISE_WEAPON_SOLIDITY_CHECKS, 1); |
| 3547 | 351 | } | |
| 3548 |
5/6✓ Branch 0 taken 351 times.
✓ Branch 1 taken 1624 times.
✓ Branch 2 taken 325 times.
✓ Branch 3 taken 26 times.
✓ Branch 4 taken 325 times.
✗ Branch 5 not taken.
|
1975 | if (compatrule_version < 83 && (tempheader.version_major >= 3 || tempheader.compareVer(2, 55, 11) < 0)) |
| 3549 |
2/2✓ Branch 0 taken 351 times.
✓ Branch 1 taken 325 times.
|
26 | set_qr(qr_BROKEN_BLOCKHOLE_PITFALLS, 1); |
| 3550 |
5/6✓ Branch 0 taken 351 times.
✓ Branch 1 taken 1949 times.
✓ Branch 2 taken 325 times.
✓ Branch 3 taken 26 times.
✓ Branch 4 taken 325 times.
✗ Branch 5 not taken.
|
2300 | if (compatrule_version < 84 && (tempheader.version_major >= 3 || tempheader.compareVer(2, 55, 11) < 0)) |
| 3551 |
2/2✓ Branch 0 taken 351 times.
✓ Branch 1 taken 325 times.
|
26 | set_qr(qr_CUSTOM_WEAPON_BROKEN_SIZE, 1); |
| 3552 |
2/2✓ Branch 0 taken 352 times.
✓ Branch 1 taken 2273 times.
|
2625 | if (compatrule_version < 85) |
| 3553 |
1/2✓ Branch 0 taken 352 times.
✗ Branch 1 not taken.
|
352 | set_qr(qr_OLD_WEAPON_REFLECTION, 1); |
| 3554 | |||
| 3555 |
2/2✓ Branch 0 taken 478 times.
✓ Branch 1 taken 2147 times.
|
2625 | set_qr(qr_ANIMATECUSTOMWEAPONS,0); |
| 3556 |
2/2✓ Branch 0 taken 282 times.
✓ Branch 1 taken 196 times.
|
478 | if (s_version < 16) |
| 3557 |
1/2✓ Branch 0 taken 282 times.
✗ Branch 1 not taken.
|
282 | set_qr(qr_BROKEN_HORIZONTAL_WEAPON_ANIM,1); |
| 3558 | |||
| 3559 |
1/2✓ Branch 0 taken 478 times.
✗ Branch 1 not taken.
|
478 | *Header = tempheader; |
| 3560 | |||
| 3561 | 478 | return 0; | |
| 3562 | 18914 | } | |
| 3563 | |||
| 3564 | 4056525 | void init_msgstr(MsgStr *str) | |
| 3565 | { | ||
| 3566 |
2/4✓ Branch 0 taken 4056525 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 4056525 times.
|
4056525 | str->setFromLegacyEncoding(""); |
| 3567 | 4056525 | str->nextstring=0; | |
| 3568 | 4056525 | str->tile=0; | |
| 3569 | 4056525 | str->cset=0; | |
| 3570 | 4056525 | str->trans=false; | |
| 3571 | 4056525 | str->font=font_zfont; | |
| 3572 | 4056525 | str->y=32; | |
| 3573 | 4056525 | str->sfx=18; | |
| 3574 | 4056525 | str->listpos=0; | |
| 3575 | 4056525 | str->x=24; | |
| 3576 | 4056525 | str->w=get_qr(qr_STRING_FRAME_OLD_WIDTH_HEIGHT)!=0 ? 24*8 : 26*8; | |
| 3577 | 4056525 | str->h=get_qr(qr_STRING_FRAME_OLD_WIDTH_HEIGHT)!=0 ? 3*8 : 5*8; | |
| 3578 | 4056525 | str->hspace=0; | |
| 3579 | 4056525 | str->vspace=0; | |
| 3580 | 4056525 | str->stringflags=0; | |
| 3581 | 4056525 | str->margins[up] = 8; | |
| 3582 | 4056525 | str->margins[down] = 0; | |
| 3583 | 4056525 | str->margins[left] = 8; | |
| 3584 | 4056525 | str->margins[right] = 8; | |
| 3585 | 4056525 | str->portrait_tile = 0; | |
| 3586 | 4056525 | str->portrait_cset = 0; | |
| 3587 | 4056525 | str->portrait_x = 0; | |
| 3588 | 4056525 | str->portrait_y = 0; | |
| 3589 | 4056525 | str->portrait_tw = 1; | |
| 3590 | 4056525 | str->portrait_th = 1; | |
| 3591 | 4056525 | str->shadow_type = 0; | |
| 3592 | 4056525 | str->shadow_color = 0; | |
| 3593 | 4056525 | str->drawlayer = 6; | |
| 3594 | 4056525 | } | |
| 3595 | |||
| 3596 | 478 | void init_msgstrings(int32_t start, int32_t end) | |
| 3597 | { | ||
| 3598 |
2/4✓ Branch 0 taken 478 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 478 times.
|
478 | if(end <= start || end-start > msg_strings_size) |
| 3599 | ✗ | return; | |
| 3600 | |||
| 3601 |
2/2✓ Branch 0 taken 478 times.
✓ Branch 1 taken 3915776 times.
|
3916254 | for(int32_t i=start; i<end; i++) |
| 3602 | { | ||
| 3603 | 3915776 | init_msgstr(&MsgStrings[i]); | |
| 3604 | 3915776 | MsgStrings[i].listpos=i; | |
| 3605 | 3915776 | } | |
| 3606 | |||
| 3607 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 478 times.
|
478 | if(start==0) |
| 3608 | { | ||
| 3609 |
2/4✓ Branch 0 taken 478 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 478 times.
|
478 | MsgStrings[0].setFromLegacyEncoding("(None)"); |
| 3610 | 478 | MsgStrings[0].listpos = 0; | |
| 3611 | 478 | } | |
| 3612 | 478 | } | |
| 3613 | |||
| 3614 | 479 | int32_t readstrings(PACKFILE *f, zquestheader *Header) | |
| 3615 | { | ||
| 3616 |
2/2✓ Branch 0 taken 24 times.
✓ Branch 1 taken 455 times.
|
479 | bool should_skip = legacy_skip_flags && get_bit(legacy_skip_flags, skip_strings); |
| 3617 | |||
| 3618 | 479 | MsgStr tempMsgString; | |
| 3619 |
1/2✓ Branch 0 taken 479 times.
✗ Branch 1 not taken.
|
479 | init_msgstr(&tempMsgString); |
| 3620 | |||
| 3621 | 479 | word temp_msg_count=0; | |
| 3622 | word temp_expansion[16]; | ||
| 3623 | 479 | memset(temp_expansion, 0, 16*sizeof(word)); | |
| 3624 | 479 | char buf[8193] = {0}; | |
| 3625 |
2/2✓ Branch 0 taken 24 times.
✓ Branch 1 taken 455 times.
|
479 | if(Header->zelda_version < 0x193) |
| 3626 | { | ||
| 3627 | byte tempbyte; | ||
| 3628 | 24 | int32_t strings_to_read=0; | |
| 3629 |
2/2✓ Branch 0 taken 23 times.
✓ Branch 1 taken 1 times.
|
24 | if (!should_skip) |
| 3630 |
1/2✓ Branch 0 taken 23 times.
✗ Branch 1 not taken.
|
23 | set_qr(qr_OLD_STRING_EDITOR_MARGINS,true); |
| 3631 |
3/4✓ Branch 0 taken 6 times.
✓ Branch 1 taken 18 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 6 times.
|
30 | if((Header->zelda_version < 0x192)|| |
| 3632 |
1/2✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
|
6 | ((Header->zelda_version == 0x192)&&(Header->build<31))) |
| 3633 | { | ||
| 3634 | 18 | strings_to_read=128; | |
| 3635 | 18 | temp_msg_count=Header->old_str_count; | |
| 3636 | |||
| 3637 | // Some sort of string count corruption seems to be common in old quests | ||
| 3638 |
1/2✓ Branch 0 taken 18 times.
✗ Branch 1 not taken.
|
18 | if(temp_msg_count>128) |
| 3639 | { | ||
| 3640 | ✗ | temp_msg_count=128; | |
| 3641 | ✗ | } | |
| 3642 | 18 | } | |
| 3643 |
2/4✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 6 times.
✗ Branch 3 not taken.
|
6 | else if((Header->zelda_version == 0x192)&&(Header->build<140)) |
| 3644 | { | ||
| 3645 | ✗ | strings_to_read=255; | |
| 3646 | ✗ | temp_msg_count=Header->old_str_count; | |
| 3647 | ✗ | } | |
| 3648 | else | ||
| 3649 | { | ||
| 3650 |
2/4✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 6 times.
✗ Branch 3 not taken.
|
6 | if(!p_igetw(&temp_msg_count,f)) |
| 3651 | { | ||
| 3652 | ✗ | return qe_invalid; | |
| 3653 | } | ||
| 3654 | |||
| 3655 | 6 | strings_to_read=temp_msg_count; | |
| 3656 | |||
| 3657 |
3/4✓ Branch 0 taken 5 times.
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 5 times.
|
6 | if (!should_skip && temp_msg_count >= msg_strings_size) |
| 3658 | { | ||
| 3659 | ✗ | Z_message("Reallocating string buffer...\n"); | |
| 3660 | |||
| 3661 | // if((MsgStrings=(MsgStr*)_al_sane_realloc(MsgStrings,sizeof(MsgStr)*MAXMSGS))==NULL) | ||
| 3662 | // return qe_nomem; | ||
| 3663 | |||
| 3664 | //memset(MsgStrings, 0, sizeof(MsgStr)*MAXMSGS); | ||
| 3665 | ✗ | delete[] MsgStrings; | |
| 3666 | ✗ | MsgStrings = new MsgStr[MAXMSGS]; | |
| 3667 | ✗ | msg_strings_size = MAXMSGS; | |
| 3668 | ✗ | for(auto q = 0; q < msg_strings_size; ++q) | |
| 3669 | { | ||
| 3670 | ✗ | MsgStrings[q].clear(); | |
| 3671 | ✗ | } | |
| 3672 | ✗ | } | |
| 3673 | } | ||
| 3674 | |||
| 3675 | //reset the message strings | ||
| 3676 |
2/2✓ Branch 0 taken 23 times.
✓ Branch 1 taken 1 times.
|
24 | if (!should_skip) |
| 3677 |
1/2✓ Branch 0 taken 23 times.
✗ Branch 1 not taken.
|
23 | init_msgstrings(0,msg_strings_size); |
| 3678 | |||
| 3679 |
2/2✓ Branch 0 taken 2550 times.
✓ Branch 1 taken 24 times.
|
2574 | for(int32_t x=0; x<strings_to_read; x++) |
| 3680 | { | ||
| 3681 |
1/2✓ Branch 0 taken 2550 times.
✗ Branch 1 not taken.
|
2550 | init_msgstr(&tempMsgString); |
| 3682 | 2550 | tempMsgString.listpos = x; | |
| 3683 | |||
| 3684 |
2/4✓ Branch 0 taken 2550 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2550 times.
✗ Branch 3 not taken.
|
2550 | if(!pfread(buf,73,f)) |
| 3685 | { | ||
| 3686 | ✗ | return qe_invalid; | |
| 3687 | } | ||
| 3688 | |||
| 3689 | 2550 | buf[74] = '\0'; | |
| 3690 |
2/4✓ Branch 0 taken 2550 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2550 times.
✗ Branch 3 not taken.
|
2550 | tempMsgString.setFromLegacyEncoding(buf); |
| 3691 | |||
| 3692 |
2/4✓ Branch 0 taken 2550 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2550 times.
✗ Branch 3 not taken.
|
2550 | if(!p_getc(&tempbyte,f)) |
| 3693 | { | ||
| 3694 | ✗ | return qe_invalid; | |
| 3695 | } | ||
| 3696 | |||
| 3697 |
3/4✓ Branch 0 taken 246 times.
✓ Branch 1 taken 2304 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 246 times.
|
2796 | if((Header->zelda_version < 0x192)|| |
| 3698 |
1/2✓ Branch 0 taken 246 times.
✗ Branch 1 not taken.
|
246 | ((Header->zelda_version == 0x192)&&(Header->build<148))) |
| 3699 | { | ||
| 3700 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2304 times.
|
2304 | tempMsgString.nextstring=tempbyte?x+1:0; |
| 3701 | |||
| 3702 |
2/4✓ Branch 0 taken 2304 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2304 times.
✗ Branch 3 not taken.
|
2304 | if(!p_getc(&tempbyte,f)) |
| 3703 | { | ||
| 3704 | ✗ | return qe_invalid; | |
| 3705 | } | ||
| 3706 | |||
| 3707 |
2/4✓ Branch 0 taken 2304 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2304 times.
✗ Branch 3 not taken.
|
2304 | if(!p_getc(&tempbyte,f)) |
| 3708 | { | ||
| 3709 | ✗ | return qe_invalid; | |
| 3710 | } | ||
| 3711 | 2304 | } | |
| 3712 | else | ||
| 3713 | { | ||
| 3714 |
2/4✓ Branch 0 taken 246 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 246 times.
✗ Branch 3 not taken.
|
246 | if(!p_igetw(&tempMsgString.nextstring,f)) |
| 3715 | { | ||
| 3716 | ✗ | return qe_invalid; | |
| 3717 | } | ||
| 3718 | |||
| 3719 |
2/4✓ Branch 0 taken 246 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 246 times.
✗ Branch 3 not taken.
|
246 | if(!pfread(temp_expansion,32,f)) |
| 3720 | { | ||
| 3721 | ✗ | return qe_invalid; | |
| 3722 | } | ||
| 3723 | } | ||
| 3724 | |||
| 3725 |
2/2✓ Branch 0 taken 2549 times.
✓ Branch 1 taken 1 times.
|
2550 | if (!should_skip) |
| 3726 | { | ||
| 3727 |
1/2✓ Branch 0 taken 2549 times.
✗ Branch 1 not taken.
|
2549 | MsgStrings[x] = tempMsgString; |
| 3728 | 2549 | } | |
| 3729 | 2550 | } | |
| 3730 | 24 | } | |
| 3731 | else | ||
| 3732 | { | ||
| 3733 | int32_t dummy_int; | ||
| 3734 | word s_version; | ||
| 3735 | |||
| 3736 | //section version info | ||
| 3737 |
2/4✓ Branch 0 taken 455 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 455 times.
✗ Branch 3 not taken.
|
455 | if(!p_igetw(&s_version,f)) |
| 3738 | { | ||
| 3739 | ✗ | return qe_invalid; | |
| 3740 | } | ||
| 3741 | |||
| 3742 | 455 | FFCore.quest_format[vStrings] = s_version; | |
| 3743 | |||
| 3744 |
2/4✓ Branch 0 taken 455 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 455 times.
✗ Branch 3 not taken.
|
455 | if(!read_deprecated_section_cversion(f)) |
| 3745 | { | ||
| 3746 | ✗ | return qe_invalid; | |
| 3747 | } | ||
| 3748 | |||
| 3749 | //section size | ||
| 3750 |
2/4✓ Branch 0 taken 455 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 455 times.
✗ Branch 3 not taken.
|
455 | if(!p_igetl(&dummy_int,f)) |
| 3751 | { | ||
| 3752 | ✗ | return qe_invalid; | |
| 3753 | } | ||
| 3754 | |||
| 3755 | //finally... section data | ||
| 3756 |
2/4✓ Branch 0 taken 455 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 455 times.
✗ Branch 3 not taken.
|
455 | if(!p_igetw(&temp_msg_count,f)) |
| 3757 | { | ||
| 3758 | ✗ | return qe_invalid; | |
| 3759 | } | ||
| 3760 | |||
| 3761 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 455 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
455 | if(temp_msg_count >= msg_strings_size && !should_skip) |
| 3762 | { | ||
| 3763 | ✗ | Z_message("Reallocating string buffer...\n"); | |
| 3764 | |||
| 3765 | ✗ | delete[] MsgStrings; | |
| 3766 | ✗ | MsgStrings = new MsgStr[MAXMSGS]; | |
| 3767 | ✗ | msg_strings_size = MAXMSGS; | |
| 3768 | ✗ | for(auto q = 0; q < msg_strings_size; ++q) | |
| 3769 | { | ||
| 3770 | ✗ | MsgStrings[q].clear(); | |
| 3771 | ✗ | } | |
| 3772 | ✗ | } | |
| 3773 | |||
| 3774 | //reset the message strings | ||
| 3775 |
2/2✓ Branch 0 taken 259 times.
✓ Branch 1 taken 196 times.
|
455 | if(s_version < 7) |
| 3776 |
1/2✓ Branch 0 taken 259 times.
✗ Branch 1 not taken.
|
259 | set_qr(qr_OLD_STRING_EDITOR_MARGINS,true); |
| 3777 |
1/2✓ Branch 0 taken 455 times.
✗ Branch 1 not taken.
|
455 | if (!should_skip) |
| 3778 |
1/2✓ Branch 0 taken 455 times.
✗ Branch 1 not taken.
|
455 | init_msgstrings(0,msg_strings_size); |
| 3779 | |||
| 3780 | 455 | int32_t string_length=(s_version<2)?73:145; | |
| 3781 | |||
| 3782 |
2/2✓ Branch 0 taken 137720 times.
✓ Branch 1 taken 455 times.
|
138175 | for(int32_t i=0; i<temp_msg_count; i++) |
| 3783 | { | ||
| 3784 |
1/2✓ Branch 0 taken 137720 times.
✗ Branch 1 not taken.
|
137720 | init_msgstr(&tempMsgString); |
| 3785 | 137720 | tempMsgString.listpos = i; | |
| 3786 |
2/2✓ Branch 0 taken 5794 times.
✓ Branch 1 taken 131926 times.
|
137720 | if(s_version > 8) |
| 3787 | { | ||
| 3788 |
2/4✓ Branch 0 taken 5794 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5794 times.
✗ Branch 3 not taken.
|
5794 | if(!p_igetl(&string_length,f)) |
| 3789 | { | ||
| 3790 | ✗ | return qe_invalid; | |
| 3791 | } | ||
| 3792 | 5794 | } | |
| 3793 | |||
| 3794 |
2/4✓ Branch 0 taken 137720 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 137720 times.
|
137720 | if (string_length < 0 || string_length > 8193) |
| 3795 | { | ||
| 3796 | ✗ | return qe_invalid; | |
| 3797 | } | ||
| 3798 | |||
| 3799 |
2/2✓ Branch 0 taken 137168 times.
✓ Branch 1 taken 552 times.
|
137720 | if (string_length > 0) |
| 3800 | { | ||
| 3801 |
2/4✓ Branch 0 taken 137168 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 137168 times.
✗ Branch 3 not taken.
|
137168 | if (!pfread(buf, string_length, f)) |
| 3802 | { | ||
| 3803 | ✗ | return qe_invalid; | |
| 3804 | } | ||
| 3805 | 137168 | } | |
| 3806 | else | ||
| 3807 | { | ||
| 3808 | 552 | buf[0] = 0; | |
| 3809 | } | ||
| 3810 | |||
| 3811 |
2/4✓ Branch 0 taken 137720 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 137720 times.
✗ Branch 3 not taken.
|
137720 | if(!p_igetw(&tempMsgString.nextstring,f)) |
| 3812 | { | ||
| 3813 | ✗ | return qe_invalid; | |
| 3814 | } | ||
| 3815 | |||
| 3816 |
2/2✓ Branch 0 taken 33613 times.
✓ Branch 1 taken 104107 times.
|
137720 | if(s_version<2) |
| 3817 | { | ||
| 3818 | 33613 | buf[72] = '\0'; | |
| 3819 |
2/4✗ Branch 0 not taken.
✓ Branch 1 taken 33613 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 33613 times.
|
33613 | tempMsgString.setFromLegacyEncoding(buf); |
| 3820 | 33613 | } | |
| 3821 | else | ||
| 3822 | { | ||
| 3823 | // June 2008: A bug corrupted the last 4 chars of a string. | ||
| 3824 | // Discard these. | ||
| 3825 |
1/2✓ Branch 0 taken 104107 times.
✗ Branch 1 not taken.
|
104107 | if(s_version<3) |
| 3826 | { | ||
| 3827 | ✗ | for(int32_t j=140; j<144; j++) | |
| 3828 | { | ||
| 3829 | ✗ | buf[j] = '\0'; | |
| 3830 | ✗ | } | |
| 3831 | ✗ | } | |
| 3832 |
1/2✓ Branch 0 taken 104107 times.
✗ Branch 1 not taken.
|
104107 | if(string_length > 8192) string_length = 8192; |
| 3833 | 104107 | buf[string_length]='\0'; //Force-terminate | |
| 3834 |
2/4✗ Branch 0 not taken.
✓ Branch 1 taken 104107 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 104107 times.
|
104107 | tempMsgString.setFromLegacyEncoding(buf); |
| 3835 | |||
| 3836 |
2/2✓ Branch 0 taken 5794 times.
✓ Branch 1 taken 98313 times.
|
104107 | if ( s_version >= 6 ) |
| 3837 | { | ||
| 3838 |
2/4✓ Branch 0 taken 5794 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5794 times.
✗ Branch 3 not taken.
|
5794 | if(!p_igetl(&tempMsgString.tile,f)) |
| 3839 | { | ||
| 3840 | ✗ | return qe_invalid; | |
| 3841 | } | ||
| 3842 | 5794 | } | |
| 3843 | else | ||
| 3844 | { | ||
| 3845 |
2/4✓ Branch 0 taken 98313 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 98313 times.
✗ Branch 3 not taken.
|
98313 | if(!p_igetw(&tempMsgString.tile,f)) |
| 3846 | { | ||
| 3847 | ✗ | return qe_invalid; | |
| 3848 | } | ||
| 3849 | } | ||
| 3850 | |||
| 3851 |
2/4✓ Branch 0 taken 104107 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 104107 times.
✗ Branch 3 not taken.
|
104107 | if(!p_getc(&tempMsgString.cset,f)) |
| 3852 | { | ||
| 3853 | ✗ | return qe_invalid; | |
| 3854 | } | ||
| 3855 | |||
| 3856 | byte dummy_char; | ||
| 3857 | |||
| 3858 |
2/4✓ Branch 0 taken 104107 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 104107 times.
✗ Branch 3 not taken.
|
104107 | if(!p_getc(&dummy_char,f)) // trans is stored as a char... |
| 3859 | { | ||
| 3860 | ✗ | return qe_invalid; | |
| 3861 | } | ||
| 3862 | |||
| 3863 | 104107 | tempMsgString.trans=dummy_char!=0; | |
| 3864 | |||
| 3865 |
2/4✓ Branch 0 taken 104107 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 104107 times.
✗ Branch 3 not taken.
|
104107 | if(!p_getc(&tempMsgString.font,f)) |
| 3866 | { | ||
| 3867 | ✗ | return qe_invalid; | |
| 3868 | } | ||
| 3869 | |||
| 3870 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 104107 times.
|
104107 | if(s_version < 5) |
| 3871 | { | ||
| 3872 | ✗ | if(!p_getc(&tempMsgString.y,f)) | |
| 3873 | { | ||
| 3874 | ✗ | return qe_invalid; | |
| 3875 | } | ||
| 3876 | ✗ | } | |
| 3877 | else | ||
| 3878 | { | ||
| 3879 |
2/4✓ Branch 0 taken 104107 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 104107 times.
✗ Branch 3 not taken.
|
104107 | if(!p_igetw(&tempMsgString.x,f)) |
| 3880 | { | ||
| 3881 | ✗ | return qe_invalid; | |
| 3882 | } | ||
| 3883 | |||
| 3884 |
2/4✓ Branch 0 taken 104107 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 104107 times.
✗ Branch 3 not taken.
|
104107 | if(!p_igetw(&tempMsgString.y,f)) |
| 3885 | { | ||
| 3886 | ✗ | return qe_invalid; | |
| 3887 | } | ||
| 3888 | |||
| 3889 |
2/4✓ Branch 0 taken 104107 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 104107 times.
✗ Branch 3 not taken.
|
104107 | if(!p_igetw(&tempMsgString.w,f)) |
| 3890 | { | ||
| 3891 | ✗ | return qe_invalid; | |
| 3892 | } | ||
| 3893 | |||
| 3894 |
2/4✓ Branch 0 taken 104107 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 104107 times.
✗ Branch 3 not taken.
|
104107 | if(!p_igetw(&tempMsgString.h,f)) |
| 3895 | { | ||
| 3896 | ✗ | return qe_invalid; | |
| 3897 | } | ||
| 3898 | |||
| 3899 |
2/4✓ Branch 0 taken 104107 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 104107 times.
✗ Branch 3 not taken.
|
104107 | if(!p_getc(&tempMsgString.hspace,f)) |
| 3900 | { | ||
| 3901 | ✗ | return qe_invalid; | |
| 3902 | } | ||
| 3903 | |||
| 3904 |
2/4✓ Branch 0 taken 104107 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 104107 times.
✗ Branch 3 not taken.
|
104107 | if(!p_getc(&tempMsgString.vspace,f)) |
| 3905 | { | ||
| 3906 | ✗ | return qe_invalid; | |
| 3907 | } | ||
| 3908 | |||
| 3909 |
2/4✓ Branch 0 taken 104107 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 104107 times.
✗ Branch 3 not taken.
|
104107 | if(!p_getc(&tempMsgString.stringflags,f)) |
| 3910 | { | ||
| 3911 | ✗ | return qe_invalid; | |
| 3912 | } | ||
| 3913 | } | ||
| 3914 | |||
| 3915 |
2/2✓ Branch 0 taken 98313 times.
✓ Branch 1 taken 5794 times.
|
104107 | if(s_version >= 7) |
| 3916 | { | ||
| 3917 |
2/2✓ Branch 0 taken 5794 times.
✓ Branch 1 taken 23176 times.
|
28970 | for(int32_t q = 0; q < 4; ++q) |
| 3918 | { | ||
| 3919 |
2/4✓ Branch 0 taken 23176 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 23176 times.
✗ Branch 3 not taken.
|
23176 | if(!p_getc(&tempMsgString.margins[q],f)) |
| 3920 | { | ||
| 3921 | ✗ | return qe_invalid; | |
| 3922 | } | ||
| 3923 | 23176 | } | |
| 3924 | |||
| 3925 |
2/4✓ Branch 0 taken 5794 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5794 times.
✗ Branch 3 not taken.
|
5794 | if(!p_igetl(&tempMsgString.portrait_tile,f)) |
| 3926 | { | ||
| 3927 | ✗ | return qe_invalid; | |
| 3928 | } | ||
| 3929 | |||
| 3930 |
2/4✓ Branch 0 taken 5794 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5794 times.
✗ Branch 3 not taken.
|
5794 | if(!p_getc(&tempMsgString.portrait_cset,f)) |
| 3931 | { | ||
| 3932 | ✗ | return qe_invalid; | |
| 3933 | } | ||
| 3934 | |||
| 3935 |
2/4✓ Branch 0 taken 5794 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5794 times.
✗ Branch 3 not taken.
|
5794 | if(!p_getc(&tempMsgString.portrait_x,f)) |
| 3936 | { | ||
| 3937 | ✗ | return qe_invalid; | |
| 3938 | } | ||
| 3939 | |||
| 3940 |
2/4✓ Branch 0 taken 5794 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5794 times.
✗ Branch 3 not taken.
|
5794 | if(!p_getc(&tempMsgString.portrait_y,f)) |
| 3941 | { | ||
| 3942 | ✗ | return qe_invalid; | |
| 3943 | } | ||
| 3944 | |||
| 3945 |
2/4✓ Branch 0 taken 5794 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5794 times.
✗ Branch 3 not taken.
|
5794 | if(!p_getc(&tempMsgString.portrait_tw,f)) |
| 3946 | { | ||
| 3947 | ✗ | return qe_invalid; | |
| 3948 | } | ||
| 3949 | |||
| 3950 |
2/4✓ Branch 0 taken 5794 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5794 times.
✗ Branch 3 not taken.
|
5794 | if(!p_getc(&tempMsgString.portrait_th,f)) |
| 3951 | { | ||
| 3952 | ✗ | return qe_invalid; | |
| 3953 | } | ||
| 3954 | 5794 | } | |
| 3955 | |||
| 3956 |
2/2✓ Branch 0 taken 5794 times.
✓ Branch 1 taken 98313 times.
|
104107 | if(s_version >= 8) |
| 3957 | { | ||
| 3958 |
2/4✓ Branch 0 taken 5794 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5794 times.
✗ Branch 3 not taken.
|
5794 | if(!p_getc(&tempMsgString.shadow_type,f)) |
| 3959 | { | ||
| 3960 | ✗ | return qe_invalid; | |
| 3961 | } | ||
| 3962 | |||
| 3963 |
2/4✓ Branch 0 taken 5794 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5794 times.
✗ Branch 3 not taken.
|
5794 | if(!p_getc(&tempMsgString.shadow_color,f)) |
| 3964 | { | ||
| 3965 | ✗ | return qe_invalid; | |
| 3966 | } | ||
| 3967 | 5794 | } | |
| 3968 | |||
| 3969 |
2/2✓ Branch 0 taken 5560 times.
✓ Branch 1 taken 98547 times.
|
104107 | if(s_version >= 10) |
| 3970 | { | ||
| 3971 |
2/4✓ Branch 0 taken 5560 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5560 times.
✗ Branch 3 not taken.
|
5560 | if(!p_getc(&tempMsgString.drawlayer,f)) |
| 3972 | { | ||
| 3973 | ✗ | return qe_invalid; | |
| 3974 | } | ||
| 3975 | 5560 | } | |
| 3976 | |||
| 3977 |
2/4✓ Branch 0 taken 104107 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 104107 times.
✗ Branch 3 not taken.
|
104107 | if(!p_getc(&tempMsgString.sfx,f)) |
| 3978 | { | ||
| 3979 | ✗ | return qe_invalid; | |
| 3980 | } | ||
| 3981 | |||
| 3982 |
1/2✓ Branch 0 taken 104107 times.
✗ Branch 1 not taken.
|
104107 | if(s_version>3) |
| 3983 | { | ||
| 3984 |
2/4✓ Branch 0 taken 104107 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 104107 times.
✗ Branch 3 not taken.
|
104107 | if(!p_igetw(&tempMsgString.listpos,f)) |
| 3985 | { | ||
| 3986 | ✗ | return qe_invalid; | |
| 3987 | } | ||
| 3988 | 104107 | } | |
| 3989 | } | ||
| 3990 | |||
| 3991 |
1/2✓ Branch 0 taken 137720 times.
✗ Branch 1 not taken.
|
137720 | if (!should_skip) |
| 3992 | { | ||
| 3993 |
1/2✓ Branch 0 taken 137720 times.
✗ Branch 1 not taken.
|
137720 | MsgStrings[i].copyAll(tempMsgString); |
| 3994 | 137720 | } | |
| 3995 | 137720 | } | |
| 3996 | } | ||
| 3997 | |||
| 3998 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 478 times.
|
479 | if (!should_skip) |
| 3999 | 478 | msg_count=temp_msg_count; | |
| 4000 | |||
| 4001 | 479 | return 0; | |
| 4002 | 479 | } | |
| 4003 | |||
| 4004 | 479 | int32_t readdoorcombosets(PACKFILE *f, zquestheader *Header) | |
| 4005 | { | ||
| 4006 |
2/2✓ Branch 0 taken 24 times.
✓ Branch 1 taken 455 times.
|
479 | bool should_skip = legacy_skip_flags && get_bit(legacy_skip_flags, skip_doors); |
| 4007 | |||
| 4008 |
3/4✓ Branch 0 taken 461 times.
✓ Branch 1 taken 18 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 6 times.
|
485 | if((Header->zelda_version < 0x192)|| |
| 4009 |
2/2✓ Branch 0 taken 6 times.
✓ Branch 1 taken 455 times.
|
461 | ((Header->zelda_version == 0x192)&&(Header->build<158))) |
| 4010 | { | ||
| 4011 | 18 | return 0; | |
| 4012 | } | ||
| 4013 | |||
| 4014 | 461 | word temp_door_combo_set_count=0; | |
| 4015 | DoorComboSet tempDoorComboSet; | ||
| 4016 | word dummy_word; | ||
| 4017 | int32_t dummy_long; | ||
| 4018 | byte padding; | ||
| 4019 | 461 | int32_t s_version = 0; | |
| 4020 | |||
| 4021 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 460 times.
|
461 | if (!should_skip) |
| 4022 | { | ||
| 4023 | 460 | DoorComboSets = {}; | |
| 4024 | 460 | DoorComboSetNames = {}; | |
| 4025 | 460 | } | |
| 4026 | |||
| 4027 |
2/2✓ Branch 0 taken 6 times.
✓ Branch 1 taken 455 times.
|
461 | if(Header->zelda_version > 0x192) |
| 4028 | { | ||
| 4029 | //section version info | ||
| 4030 |
1/2✓ Branch 0 taken 455 times.
✗ Branch 1 not taken.
|
455 | if(!p_igetw(&s_version,f)) |
| 4031 | { | ||
| 4032 | ✗ | return qe_invalid; | |
| 4033 | } | ||
| 4034 | |||
| 4035 | 455 | FFCore.quest_format[vDoors] = s_version; | |
| 4036 | |||
| 4037 |
1/2✓ Branch 0 taken 455 times.
✗ Branch 1 not taken.
|
455 | if(!p_igetw(&dummy_word,f)) |
| 4038 | { | ||
| 4039 | ✗ | return qe_invalid; | |
| 4040 | } | ||
| 4041 | |||
| 4042 | //section size | ||
| 4043 |
1/2✓ Branch 0 taken 455 times.
✗ Branch 1 not taken.
|
455 | if(!p_igetl(&dummy_long,f)) |
| 4044 | { | ||
| 4045 | ✗ | return qe_invalid; | |
| 4046 | } | ||
| 4047 | 455 | } | |
| 4048 | |||
| 4049 | //finally... section data | ||
| 4050 |
1/2✓ Branch 0 taken 461 times.
✗ Branch 1 not taken.
|
461 | if(!p_igetw(&temp_door_combo_set_count,f)) |
| 4051 | { | ||
| 4052 | ✗ | return qe_invalid; | |
| 4053 | } | ||
| 4054 | |||
| 4055 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 461 times.
|
461 | if (temp_door_combo_set_count > MAXDOORCOMBOSETS) |
| 4056 | { | ||
| 4057 | ✗ | return qe_invalid; | |
| 4058 | } | ||
| 4059 | |||
| 4060 |
2/2✓ Branch 0 taken 5338 times.
✓ Branch 1 taken 461 times.
|
5799 | for(int32_t i=0; i<temp_door_combo_set_count; i++) |
| 4061 | { | ||
| 4062 | 5338 | memset(&tempDoorComboSet, 0, sizeof(DoorComboSet)); | |
| 4063 | |||
| 4064 | //name | ||
| 4065 | char name[21]; | ||
| 4066 |
1/2✓ Branch 0 taken 5338 times.
✗ Branch 1 not taken.
|
5338 | if(!pfread(&name,sizeof(name),f)) |
| 4067 | { | ||
| 4068 | ✗ | return qe_invalid; | |
| 4069 | } | ||
| 4070 |
2/2✓ Branch 0 taken 14 times.
✓ Branch 1 taken 5324 times.
|
5338 | if (!should_skip) |
| 4071 | 5324 | DoorComboSetNames[i] = name; | |
| 4072 | |||
| 4073 |
2/2✓ Branch 0 taken 5298 times.
✓ Branch 1 taken 40 times.
|
5338 | if(Header->zelda_version < 0x193) |
| 4074 | { | ||
| 4075 |
1/2✓ Branch 0 taken 40 times.
✗ Branch 1 not taken.
|
40 | if(!p_getc(&padding,f)) |
| 4076 | { | ||
| 4077 | ✗ | return qe_invalid; | |
| 4078 | } | ||
| 4079 | 40 | } | |
| 4080 | |||
| 4081 | //up door | ||
| 4082 |
2/2✓ Branch 0 taken 48042 times.
✓ Branch 1 taken 5338 times.
|
53380 | for(int32_t j=0; j<9; j++) |
| 4083 | { | ||
| 4084 |
2/2✓ Branch 0 taken 192168 times.
✓ Branch 1 taken 48042 times.
|
240210 | for(int32_t k=0; k<4; k++) |
| 4085 | { | ||
| 4086 |
1/2✓ Branch 0 taken 192168 times.
✗ Branch 1 not taken.
|
192168 | if(!p_igetw(&tempDoorComboSet.doorcombo_u[j][k],f)) |
| 4087 | { | ||
| 4088 | ✗ | return qe_invalid; | |
| 4089 | } | ||
| 4090 | 192168 | } | |
| 4091 | 48042 | } | |
| 4092 | |||
| 4093 |
2/2✓ Branch 0 taken 48042 times.
✓ Branch 1 taken 5338 times.
|
53380 | for(int32_t j=0; j<9; j++) |
| 4094 | { | ||
| 4095 |
2/2✓ Branch 0 taken 192168 times.
✓ Branch 1 taken 48042 times.
|
240210 | for(int32_t k=0; k<4; k++) |
| 4096 | { | ||
| 4097 |
1/2✓ Branch 0 taken 192168 times.
✗ Branch 1 not taken.
|
192168 | if(!p_getc(&tempDoorComboSet.doorcset_u[j][k],f)) |
| 4098 | { | ||
| 4099 | ✗ | return qe_invalid; | |
| 4100 | } | ||
| 4101 | 192168 | } | |
| 4102 | 48042 | } | |
| 4103 | |||
| 4104 | //down door | ||
| 4105 |
2/2✓ Branch 0 taken 48042 times.
✓ Branch 1 taken 5338 times.
|
53380 | for(int32_t j=0; j<9; j++) |
| 4106 | { | ||
| 4107 |
2/2✓ Branch 0 taken 192168 times.
✓ Branch 1 taken 48042 times.
|
240210 | for(int32_t k=0; k<4; k++) |
| 4108 | { | ||
| 4109 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 192168 times.
|
192168 | if(!p_igetw(&tempDoorComboSet.doorcombo_d[j][k],f)) |
| 4110 | { | ||
| 4111 | ✗ | return qe_invalid; | |
| 4112 | } | ||
| 4113 | 192168 | } | |
| 4114 | 48042 | } | |
| 4115 | |||
| 4116 |
2/2✓ Branch 0 taken 48042 times.
✓ Branch 1 taken 5338 times.
|
53380 | for(int32_t j=0; j<9; j++) |
| 4117 | { | ||
| 4118 |
2/2✓ Branch 0 taken 192168 times.
✓ Branch 1 taken 48042 times.
|
240210 | for(int32_t k=0; k<4; k++) |
| 4119 | { | ||
| 4120 |
1/2✓ Branch 0 taken 192168 times.
✗ Branch 1 not taken.
|
192168 | if(!p_getc(&tempDoorComboSet.doorcset_d[j][k],f)) |
| 4121 | { | ||
| 4122 | ✗ | return qe_invalid; | |
| 4123 | } | ||
| 4124 | 192168 | } | |
| 4125 | 48042 | } | |
| 4126 | |||
| 4127 | //left door | ||
| 4128 |
2/2✓ Branch 0 taken 48042 times.
✓ Branch 1 taken 5338 times.
|
53380 | for(int32_t j=0; j<9; j++) |
| 4129 | { | ||
| 4130 |
2/2✓ Branch 0 taken 288252 times.
✓ Branch 1 taken 48042 times.
|
336294 | for(int32_t k=0; k<6; k++) |
| 4131 | { | ||
| 4132 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 288252 times.
|
288252 | if(!p_igetw(&tempDoorComboSet.doorcombo_l[j][k],f)) |
| 4133 | { | ||
| 4134 | ✗ | return qe_invalid; | |
| 4135 | } | ||
| 4136 | 288252 | } | |
| 4137 | 48042 | } | |
| 4138 | |||
| 4139 |
2/2✓ Branch 0 taken 48042 times.
✓ Branch 1 taken 5338 times.
|
53380 | for(int32_t j=0; j<9; j++) |
| 4140 | { | ||
| 4141 |
2/2✓ Branch 0 taken 288252 times.
✓ Branch 1 taken 48042 times.
|
336294 | for(int32_t k=0; k<6; k++) |
| 4142 | { | ||
| 4143 |
1/2✓ Branch 0 taken 288252 times.
✗ Branch 1 not taken.
|
288252 | if(!p_getc(&tempDoorComboSet.doorcset_l[j][k],f)) |
| 4144 | { | ||
| 4145 | ✗ | return qe_invalid; | |
| 4146 | } | ||
| 4147 | 288252 | } | |
| 4148 | 48042 | } | |
| 4149 | |||
| 4150 | //right door | ||
| 4151 |
2/2✓ Branch 0 taken 48042 times.
✓ Branch 1 taken 5338 times.
|
53380 | for(int32_t j=0; j<9; j++) |
| 4152 | { | ||
| 4153 |
2/2✓ Branch 0 taken 288252 times.
✓ Branch 1 taken 48042 times.
|
336294 | for(int32_t k=0; k<6; k++) |
| 4154 | { | ||
| 4155 |
1/2✓ Branch 0 taken 288252 times.
✗ Branch 1 not taken.
|
288252 | if(!p_igetw(&tempDoorComboSet.doorcombo_r[j][k],f)) |
| 4156 | { | ||
| 4157 | ✗ | return qe_invalid; | |
| 4158 | } | ||
| 4159 | 288252 | } | |
| 4160 | 48042 | } | |
| 4161 | |||
| 4162 |
2/2✓ Branch 0 taken 48042 times.
✓ Branch 1 taken 5338 times.
|
53380 | for(int32_t j=0; j<9; j++) |
| 4163 | { | ||
| 4164 |
2/2✓ Branch 0 taken 288252 times.
✓ Branch 1 taken 48042 times.
|
336294 | for(int32_t k=0; k<6; k++) |
| 4165 | { | ||
| 4166 |
1/2✓ Branch 0 taken 288252 times.
✗ Branch 1 not taken.
|
288252 | if(!p_getc(&tempDoorComboSet.doorcset_r[j][k],f)) |
| 4167 | { | ||
| 4168 | ✗ | return qe_invalid; | |
| 4169 | } | ||
| 4170 | 288252 | } | |
| 4171 | 48042 | } | |
| 4172 | |||
| 4173 | //up bomb rubble | ||
| 4174 |
2/2✓ Branch 0 taken 10676 times.
✓ Branch 1 taken 5338 times.
|
16014 | for(int32_t j=0; j<2; j++) |
| 4175 | { | ||
| 4176 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 10676 times.
|
10676 | if(!p_igetw(&tempDoorComboSet.bombdoorcombo_u[j],f)) |
| 4177 | { | ||
| 4178 | ✗ | return qe_invalid; | |
| 4179 | } | ||
| 4180 | 10676 | } | |
| 4181 | |||
| 4182 |
2/2✓ Branch 0 taken 10676 times.
✓ Branch 1 taken 5338 times.
|
16014 | for(int32_t j=0; j<2; j++) |
| 4183 | { | ||
| 4184 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 10676 times.
|
10676 | if(!p_getc(&tempDoorComboSet.bombdoorcset_u[j],f)) |
| 4185 | { | ||
| 4186 | ✗ | return qe_invalid; | |
| 4187 | } | ||
| 4188 | 10676 | } | |
| 4189 | |||
| 4190 | //down bomb rubble | ||
| 4191 |
2/2✓ Branch 0 taken 10676 times.
✓ Branch 1 taken 5338 times.
|
16014 | for(int32_t j=0; j<2; j++) |
| 4192 | { | ||
| 4193 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 10676 times.
|
10676 | if(!p_igetw(&tempDoorComboSet.bombdoorcombo_d[j],f)) |
| 4194 | { | ||
| 4195 | ✗ | return qe_invalid; | |
| 4196 | } | ||
| 4197 | 10676 | } | |
| 4198 | |||
| 4199 |
2/2✓ Branch 0 taken 10676 times.
✓ Branch 1 taken 5338 times.
|
16014 | for(int32_t j=0; j<2; j++) |
| 4200 | { | ||
| 4201 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 10676 times.
|
10676 | if(!p_getc(&tempDoorComboSet.bombdoorcset_d[j],f)) |
| 4202 | { | ||
| 4203 | ✗ | return qe_invalid; | |
| 4204 | } | ||
| 4205 | 10676 | } | |
| 4206 | |||
| 4207 | //left bomb rubble | ||
| 4208 |
2/2✓ Branch 0 taken 16014 times.
✓ Branch 1 taken 5338 times.
|
21352 | for(int32_t j=0; j<3; j++) |
| 4209 | { | ||
| 4210 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 16014 times.
|
16014 | if(!p_igetw(&tempDoorComboSet.bombdoorcombo_l[j],f)) |
| 4211 | { | ||
| 4212 | ✗ | return qe_invalid; | |
| 4213 | } | ||
| 4214 | 16014 | } | |
| 4215 | |||
| 4216 |
2/2✓ Branch 0 taken 16014 times.
✓ Branch 1 taken 5338 times.
|
21352 | for(int32_t j=0; j<3; j++) |
| 4217 | { | ||
| 4218 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 16014 times.
|
16014 | if(!p_getc(&tempDoorComboSet.bombdoorcset_l[j],f)) |
| 4219 | { | ||
| 4220 | ✗ | return qe_invalid; | |
| 4221 | } | ||
| 4222 | 16014 | } | |
| 4223 | |||
| 4224 |
2/2✓ Branch 0 taken 5298 times.
✓ Branch 1 taken 40 times.
|
5338 | if(Header->zelda_version < 0x193) |
| 4225 | { | ||
| 4226 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 40 times.
|
40 | if(!p_getc(&padding,f)) |
| 4227 | { | ||
| 4228 | ✗ | return qe_invalid; | |
| 4229 | } | ||
| 4230 | |||
| 4231 | 40 | } | |
| 4232 | |||
| 4233 | //right bomb rubble | ||
| 4234 |
2/2✓ Branch 0 taken 16014 times.
✓ Branch 1 taken 5338 times.
|
21352 | for(int32_t j=0; j<3; j++) |
| 4235 | { | ||
| 4236 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 16014 times.
|
16014 | if(!p_igetw(&tempDoorComboSet.bombdoorcombo_r[j],f)) |
| 4237 | { | ||
| 4238 | ✗ | return qe_invalid; | |
| 4239 | } | ||
| 4240 | 16014 | } | |
| 4241 | |||
| 4242 |
2/2✓ Branch 0 taken 16014 times.
✓ Branch 1 taken 5338 times.
|
21352 | for(int32_t j=0; j<3; j++) |
| 4243 | { | ||
| 4244 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 16014 times.
|
16014 | if(!p_getc(&tempDoorComboSet.bombdoorcset_r[j],f)) |
| 4245 | { | ||
| 4246 | ✗ | return qe_invalid; | |
| 4247 | } | ||
| 4248 | 16014 | } | |
| 4249 | |||
| 4250 |
2/2✓ Branch 0 taken 5298 times.
✓ Branch 1 taken 40 times.
|
5338 | if(Header->zelda_version < 0x193) |
| 4251 | { | ||
| 4252 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 40 times.
|
40 | if(!p_getc(&padding,f)) |
| 4253 | { | ||
| 4254 | ✗ | return qe_invalid; | |
| 4255 | } | ||
| 4256 | 40 | } | |
| 4257 | |||
| 4258 | //walkthrough stuff | ||
| 4259 |
2/2✓ Branch 0 taken 21352 times.
✓ Branch 1 taken 5338 times.
|
26690 | for(int32_t j=0; j<4; j++) |
| 4260 | { | ||
| 4261 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 21352 times.
|
21352 | if(!p_igetw(&tempDoorComboSet.walkthroughcombo[j],f)) |
| 4262 | { | ||
| 4263 | ✗ | return qe_invalid; | |
| 4264 | } | ||
| 4265 | 21352 | } | |
| 4266 | |||
| 4267 |
2/2✓ Branch 0 taken 21352 times.
✓ Branch 1 taken 5338 times.
|
26690 | for(int32_t j=0; j<4; j++) |
| 4268 | { | ||
| 4269 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 21352 times.
|
21352 | if(!p_getc(&tempDoorComboSet.walkthroughcset[j],f)) |
| 4270 | { | ||
| 4271 | ✗ | return qe_invalid; | |
| 4272 | } | ||
| 4273 | 21352 | } | |
| 4274 | |||
| 4275 | //flags | ||
| 4276 |
2/2✓ Branch 0 taken 10676 times.
✓ Branch 1 taken 5338 times.
|
16014 | for(int32_t j=0; j<2; j++) |
| 4277 | { | ||
| 4278 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 10676 times.
|
10676 | if(!p_getc(&tempDoorComboSet.flags[j],f)) |
| 4279 | { | ||
| 4280 | ✗ | return qe_invalid; | |
| 4281 | } | ||
| 4282 | 10676 | } | |
| 4283 | |||
| 4284 |
2/2✓ Branch 0 taken 5298 times.
✓ Branch 1 taken 40 times.
|
5338 | if(Header->zelda_version < 0x193) |
| 4285 | { | ||
| 4286 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 40 times.
|
40 | if(!pfread(&tempDoorComboSet.expansion,sizeof(tempDoorComboSet.expansion),f)) |
| 4287 | { | ||
| 4288 | ✗ | return qe_invalid; | |
| 4289 | } | ||
| 4290 | 40 | } | |
| 4291 | |||
| 4292 |
2/2✓ Branch 0 taken 14 times.
✓ Branch 1 taken 5324 times.
|
5338 | if (!should_skip) |
| 4293 | 5324 | memcpy(&DoorComboSets[i], &tempDoorComboSet, sizeof(tempDoorComboSet)); | |
| 4294 | 5338 | } | |
| 4295 | |||
| 4296 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 460 times.
|
461 | if (!should_skip) |
| 4297 | 460 | door_combo_set_count=temp_door_combo_set_count; | |
| 4298 | |||
| 4299 | 461 | return 0; | |
| 4300 | 479 | } | |
| 4301 | |||
| 4302 | 9 | int32_t count_dmaps() | |
| 4303 | { | ||
| 4304 | 9 | int32_t i=MAXDMAPS-1; | |
| 4305 | 9 | bool found=false; | |
| 4306 | |||
| 4307 |
4/4✓ Branch 0 taken 9 times.
✓ Branch 1 taken 18 times.
✓ Branch 2 taken 18 times.
✓ Branch 3 taken 9 times.
|
9 | while(i>=0 && !found) |
| 4308 | { | ||
| 4309 |
4/6✓ Branch 0 taken 9 times.
✓ Branch 1 taken 9 times.
✓ Branch 2 taken 9 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 9 times.
✗ Branch 5 not taken.
|
27 | if((DMaps[i].map!=0)||(DMaps[i].level!=0)||(DMaps[i].xoff!=0)|| |
| 4310 |
3/6✓ Branch 0 taken 9 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 9 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 9 times.
✗ Branch 5 not taken.
|
9 | (DMaps[i].compass!=0)||(DMaps[i].color!=0)||(DMaps[i].midi!=0)|| |
| 4311 |
1/2✓ Branch 0 taken 9 times.
✗ Branch 1 not taken.
|
9 | (DMaps[i].cont!=0)||(DMaps[i].type!=0)) |
| 4312 | 18 | found=true; | |
| 4313 | |||
| 4314 |
2/2✓ Branch 0 taken 72 times.
✓ Branch 1 taken 18 times.
|
90 | for(int32_t j=0; j<8; j++) |
| 4315 | { | ||
| 4316 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 72 times.
|
72 | if(DMaps[i].grid[j]!=0) |
| 4317 | |||
| 4318 | ✗ | found=true; | |
| 4319 | 72 | } | |
| 4320 | |||
| 4321 |
5/6✓ Branch 0 taken 9 times.
✓ Branch 1 taken 9 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 9 times.
✓ Branch 4 taken 9 times.
✓ Branch 5 taken 9 times.
|
18 | if((DMaps[i].name[0]!=0)||(DMaps[i].title[0]!=0)|| |
| 4322 | ✗ | (DMaps[i].intro[0]!=0)||(DMaps[i].tmusic[0]!=0)) | |
| 4323 | 27 | found=true; | |
| 4324 | |||
| 4325 |
3/4✓ Branch 0 taken 9 times.
✓ Branch 1 taken 9 times.
✓ Branch 2 taken 9 times.
✗ Branch 3 not taken.
|
27 | if((DMaps[i].minimap_tile[0]!=0)||(DMaps[i].minimap_tile[1]!=0)|| |
| 4326 |
2/4✓ Branch 0 taken 9 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 9 times.
✗ Branch 3 not taken.
|
9 | (DMaps[i].largemap_tile[0]!=0)||(DMaps[i].largemap_tile[1]!=0)|| |
| 4327 |
2/4✓ Branch 0 taken 9 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 9 times.
✗ Branch 3 not taken.
|
9 | (DMaps[i].minimap_cset[0]!=0)||(DMaps[i].minimap_cset[1]!=0)|| |
| 4328 |
1/2✓ Branch 0 taken 9 times.
✗ Branch 1 not taken.
|
9 | (DMaps[i].largemap_cset[0]!=0)||(DMaps[i].largemap_cset[1]!=0)) |
| 4329 | 18 | found=true; | |
| 4330 | |||
| 4331 | ✗ | if(!found) | |
| 4332 | { | ||
| 4333 | ✗ | i--; | |
| 4334 | ✗ | } | |
| 4335 | } | ||
| 4336 | |||
| 4337 | 9 | return i+1; | |
| 4338 | } | ||
| 4339 | |||
| 4340 | |||
| 4341 | 9 | int32_t count_shops(miscQdata *Misc) | |
| 4342 | { | ||
| 4343 | 9 | int32_t i=NUM_SHOPS-1,j; | |
| 4344 | 9 | bool found=false; | |
| 4345 | |||
| 4346 |
4/4✓ Branch 0 taken 4 times.
✓ Branch 1 taken 2234 times.
✓ Branch 2 taken 2229 times.
✓ Branch 3 taken 9 times.
|
2238 | while(i>=0 && !found) |
| 4347 | { | ||
| 4348 | 2229 | j=2; | |
| 4349 | |||
| 4350 |
4/4✓ Branch 0 taken 2224 times.
✓ Branch 1 taken 6682 times.
✓ Branch 2 taken 6677 times.
✓ Branch 3 taken 2229 times.
|
8906 | while(j>=0 && !found) |
| 4351 | { | ||
| 4352 |
3/4✓ Branch 0 taken 6672 times.
✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 6672 times.
|
6677 | if((Misc->shop[i].hasitem[j]!=0)||(Misc->shop[i].price[j]!=0)) |
| 4353 | { | ||
| 4354 | 5 | found=true; | |
| 4355 | 5 | } | |
| 4356 | else | ||
| 4357 | { | ||
| 4358 | 6672 | j--; | |
| 4359 | } | ||
| 4360 | } | ||
| 4361 | |||
| 4362 |
1/2✓ Branch 0 taken 2229 times.
✗ Branch 1 not taken.
|
2229 | if(Misc->shop[i].name[0]!=0) |
| 4363 | { | ||
| 4364 | ✗ | found=true; | |
| 4365 | ✗ | } | |
| 4366 | |||
| 4367 |
2/2✓ Branch 0 taken 5 times.
✓ Branch 1 taken 2224 times.
|
2229 | if(!found) |
| 4368 | { | ||
| 4369 | 2224 | i--; | |
| 4370 | 2224 | } | |
| 4371 | } | ||
| 4372 | |||
| 4373 | 9 | return i+1; | |
| 4374 | } | ||
| 4375 | |||
| 4376 | 9 | int32_t count_infos(miscQdata *Misc) | |
| 4377 | { | ||
| 4378 | 9 | int32_t i=255,j; | |
| 4379 | 9 | bool found=false; | |
| 4380 | |||
| 4381 |
4/4✓ Branch 0 taken 4 times.
✓ Branch 1 taken 2234 times.
✓ Branch 2 taken 2229 times.
✓ Branch 3 taken 9 times.
|
2238 | while(i>=0 && !found) |
| 4382 | { | ||
| 4383 | 2229 | j=2; | |
| 4384 | |||
| 4385 |
4/4✓ Branch 0 taken 2224 times.
✓ Branch 1 taken 6682 times.
✓ Branch 2 taken 6677 times.
✓ Branch 3 taken 2229 times.
|
8906 | while(j>=0 && !found) |
| 4386 | { | ||
| 4387 |
4/4✓ Branch 0 taken 6676 times.
✓ Branch 1 taken 1 times.
✓ Branch 2 taken 4 times.
✓ Branch 3 taken 6672 times.
|
6677 | if((Misc->info[i].str[j]!=0)||(Misc->info[i].price[j]!=0)) |
| 4388 | { | ||
| 4389 | 5 | found=true; | |
| 4390 | 5 | } | |
| 4391 | else | ||
| 4392 | { | ||
| 4393 | 6672 | j--; | |
| 4394 | } | ||
| 4395 | } | ||
| 4396 | |||
| 4397 |
1/2✓ Branch 0 taken 2229 times.
✗ Branch 1 not taken.
|
2229 | if(Misc->info[i].name[0]!=0) |
| 4398 | { | ||
| 4399 | ✗ | found=true; | |
| 4400 | ✗ | } | |
| 4401 | |||
| 4402 |
2/2✓ Branch 0 taken 5 times.
✓ Branch 1 taken 2224 times.
|
2229 | if(!found) |
| 4403 | { | ||
| 4404 | 2224 | i--; | |
| 4405 | 2224 | } | |
| 4406 | } | ||
| 4407 | |||
| 4408 | 9 | return i+1; | |
| 4409 | } | ||
| 4410 | |||
| 4411 | 9 | int32_t count_warprings(miscQdata *Misc) | |
| 4412 | { | ||
| 4413 | 9 | int32_t i=15,j; | |
| 4414 | 9 | bool found=false; | |
| 4415 | |||
| 4416 |
3/4✗ Branch 0 not taken.
✓ Branch 1 taken 58 times.
✓ Branch 2 taken 49 times.
✓ Branch 3 taken 9 times.
|
58 | while(i>=0 && !found) |
| 4417 | { | ||
| 4418 | 49 | j=7; | |
| 4419 | |||
| 4420 |
4/4✓ Branch 0 taken 40 times.
✓ Branch 1 taken 367 times.
✓ Branch 2 taken 358 times.
✓ Branch 3 taken 49 times.
|
407 | while(j>=0 && !found) |
| 4421 | { | ||
| 4422 |
4/4✓ Branch 0 taken 354 times.
✓ Branch 1 taken 4 times.
✓ Branch 2 taken 5 times.
✓ Branch 3 taken 349 times.
|
358 | if((Misc->warp[i].dmap[j]!=0)||(Misc->warp[i].scr[j]!=0)) |
| 4423 | { | ||
| 4424 | 9 | found=true; | |
| 4425 | 9 | } | |
| 4426 | else | ||
| 4427 | { | ||
| 4428 | 349 | j--; | |
| 4429 | } | ||
| 4430 | } | ||
| 4431 | |||
| 4432 |
2/2✓ Branch 0 taken 9 times.
✓ Branch 1 taken 40 times.
|
49 | if(!found) |
| 4433 | { | ||
| 4434 | 40 | i--; | |
| 4435 | 40 | } | |
| 4436 | } | ||
| 4437 | |||
| 4438 | 9 | return i+1; | |
| 4439 | } | ||
| 4440 | |||
| 4441 | 9 | int32_t count_palcycles(miscQdata *Misc) | |
| 4442 | { | ||
| 4443 | 9 | int32_t i=255,j; | |
| 4444 | 9 | bool found=false; | |
| 4445 | |||
| 4446 |
4/4✓ Branch 0 taken 2 times.
✓ Branch 1 taken 2043 times.
✓ Branch 2 taken 2036 times.
✓ Branch 3 taken 9 times.
|
2045 | while(i>=0 && !found) |
| 4447 | { | ||
| 4448 | 2036 | j=2; | |
| 4449 | |||
| 4450 |
4/4✓ Branch 0 taken 2029 times.
✓ Branch 1 taken 6101 times.
✓ Branch 2 taken 6094 times.
✓ Branch 3 taken 2036 times.
|
8130 | while(j>=0 && !found) |
| 4451 | { | ||
| 4452 |
2/2✓ Branch 0 taken 7 times.
✓ Branch 1 taken 6087 times.
|
6094 | if(Misc->cycles[i][j].count!=0) |
| 4453 | { | ||
| 4454 | 7 | found=true; | |
| 4455 | 7 | } | |
| 4456 | else | ||
| 4457 | { | ||
| 4458 | 6087 | j--; | |
| 4459 | } | ||
| 4460 | } | ||
| 4461 | |||
| 4462 |
2/2✓ Branch 0 taken 7 times.
✓ Branch 1 taken 2029 times.
|
2036 | if(!found) |
| 4463 | { | ||
| 4464 | 2029 | i--; | |
| 4465 | 2029 | } | |
| 4466 | } | ||
| 4467 | |||
| 4468 | 9 | return i+1; | |
| 4469 | } | ||
| 4470 | |||
| 4471 | 18088 | void clear_screen(mapscr *temp_scr) | |
| 4472 | { | ||
| 4473 | 18088 | temp_scr->zero_memory(); | |
| 4474 | 18088 | } | |
| 4475 | |||
| 4476 | // NOTE: when modifying this, you need to also update: | ||
| 4477 | // readonedmap, readdmaps, and FFScript::read_dmaps | ||
| 4478 | // (and their associated write functions) | ||
| 4479 | 3551 | int32_t readdmaps(PACKFILE *f, zquestheader *Header, word, word, word start_dmap, word max_dmaps) | |
| 4480 | { | ||
| 4481 |
2/2✓ Branch 0 taken 3527 times.
✓ Branch 1 taken 24 times.
|
3551 | bool should_skip = legacy_skip_flags && get_bit(legacy_skip_flags, skip_dmaps); |
| 4482 | |||
| 4483 | 3551 | word dmapstoread=0; | |
| 4484 | 3551 | dmap tempDMap; | |
| 4485 | |||
| 4486 | int32_t dummy; | ||
| 4487 | 3551 | word s_version=0; | |
| 4488 | byte padding; | ||
| 4489 | |||
| 4490 | char legacy_title[22]; | ||
| 4491 | |||
| 4492 |
2/2✓ Branch 0 taken 3073 times.
✓ Branch 1 taken 478 times.
|
3551 | if (!should_skip) |
| 4493 |
2/2✓ Branch 0 taken 244736 times.
✓ Branch 1 taken 478 times.
|
245214 | for(int32_t i=0; i<max_dmaps; i++) |
| 4494 | { | ||
| 4495 |
1/2✓ Branch 0 taken 244736 times.
✗ Branch 1 not taken.
|
244736 | DMaps[start_dmap + i].clear(); |
| 4496 | 244736 | sprintf(legacy_title," "); | |
| 4497 | 244736 | sprintf(DMaps[start_dmap+i].intro," "); | |
| 4498 | 244736 | DMaps[start_dmap+i].type |= dmCAVE; | |
| 4499 | 245214 | } | |
| 4500 | |||
| 4501 |
3/4✓ Branch 0 taken 478 times.
✓ Branch 1 taken 3073 times.
✓ Branch 2 taken 478 times.
✗ Branch 3 not taken.
|
3551 | if (!should_skip && s_version == 21) |
| 4502 | ✗ | Regions = {}; | |
| 4503 | |||
| 4504 | 3551 | Header->is_z3 = false; | |
| 4505 |
4/4✓ Branch 0 taken 479 times.
✓ Branch 1 taken 3072 times.
✓ Branch 2 taken 455 times.
✓ Branch 3 taken 24 times.
|
3551 | if(!Header || Header->zelda_version > 0x192) |
| 4506 | { | ||
| 4507 | //section version info | ||
| 4508 |
3/4✓ Branch 0 taken 455 times.
✓ Branch 1 taken 3072 times.
✓ Branch 2 taken 455 times.
✗ Branch 3 not taken.
|
3527 | if(!p_igetw(&s_version,f)) |
| 4509 | { | ||
| 4510 | ✗ | return qe_invalid; | |
| 4511 | } | ||
| 4512 | 455 | Header->is_z3 = s_version >= 22; | |
| 4513 | |||
| 4514 | 455 | FFCore.quest_format[vDMaps] = s_version; | |
| 4515 | |||
| 4516 | |||
| 4517 |
2/4✓ Branch 0 taken 455 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 455 times.
✗ Branch 3 not taken.
|
455 | if(!read_deprecated_section_cversion(f)) |
| 4518 | { | ||
| 4519 | ✗ | return qe_invalid; | |
| 4520 | } | ||
| 4521 | |||
| 4522 | //section size | ||
| 4523 |
2/4✓ Branch 0 taken 455 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 455 times.
✗ Branch 3 not taken.
|
455 | if(!p_igetl(&dummy,f)) |
| 4524 | { | ||
| 4525 | ✗ | return qe_invalid; | |
| 4526 | } | ||
| 4527 | |||
| 4528 | //finally... section data | ||
| 4529 |
2/4✓ Branch 0 taken 455 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 455 times.
✗ Branch 3 not taken.
|
455 | if(!p_igetw(&dmapstoread,f)) |
| 4530 | { | ||
| 4531 | ✗ | return qe_invalid; | |
| 4532 | } | ||
| 4533 | 455 | } | |
| 4534 | else | ||
| 4535 | { | ||
| 4536 |
3/4✓ Branch 0 taken 6 times.
✓ Branch 1 taken 18 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 6 times.
|
30 | if((Header->zelda_version < 0x192)|| |
| 4537 |
1/2✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
|
6 | ((Header->zelda_version == 0x192)&&(Header->build<5))) |
| 4538 | { | ||
| 4539 | 18 | dmapstoread=32; | |
| 4540 | 18 | } | |
| 4541 |
1/2✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
|
6 | else if(s_version <= 4) |
| 4542 | { | ||
| 4543 | 6 | dmapstoread=OLDMAXDMAPS; | |
| 4544 | 6 | } | |
| 4545 | else | ||
| 4546 | { | ||
| 4547 | ✗ | dmapstoread=MAXDMAPS; | |
| 4548 | } | ||
| 4549 | } | ||
| 4550 | |||
| 4551 |
2/2✓ Branch 0 taken 83 times.
✓ Branch 1 taken 396 times.
|
479 | dmapstoread=zc_min(dmapstoread, max_dmaps); |
| 4552 |
2/2✓ Branch 0 taken 83 times.
✓ Branch 1 taken 396 times.
|
479 | dmapstoread=zc_min(dmapstoread, MAXDMAPS-start_dmap); |
| 4553 | |||
| 4554 |
2/2✓ Branch 0 taken 219968 times.
✓ Branch 1 taken 479 times.
|
220447 | for(int32_t i=start_dmap; i<dmapstoread+start_dmap; i++) |
| 4555 | { | ||
| 4556 |
1/2✓ Branch 0 taken 219968 times.
✗ Branch 1 not taken.
|
219968 | tempDMap.clear(); |
| 4557 | 219968 | sprintf(legacy_title," "); | |
| 4558 | 219968 | sprintf(tempDMap.intro," "); | |
| 4559 | |||
| 4560 |
2/4✓ Branch 0 taken 219968 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 219968 times.
✗ Branch 3 not taken.
|
219968 | if(!p_getc(&tempDMap.map,f)) |
| 4561 | { | ||
| 4562 | ✗ | return qe_invalid; | |
| 4563 | } | ||
| 4564 | |||
| 4565 |
2/2✓ Branch 0 taken 17216 times.
✓ Branch 1 taken 202752 times.
|
219968 | if(s_version <= 4) |
| 4566 | { | ||
| 4567 | byte tempbyte; | ||
| 4568 | |||
| 4569 |
2/4✓ Branch 0 taken 17216 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 17216 times.
✗ Branch 3 not taken.
|
17216 | if(!p_getc(&tempbyte,f)) |
| 4570 | { | ||
| 4571 | ✗ | return qe_invalid; | |
| 4572 | } | ||
| 4573 | |||
| 4574 | 17216 | tempDMap.level=(word)tempbyte; | |
| 4575 | 17216 | } | |
| 4576 | else | ||
| 4577 | { | ||
| 4578 |
2/4✓ Branch 0 taken 202752 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 202752 times.
✗ Branch 3 not taken.
|
202752 | if(!p_igetw(&tempDMap.level,f)) |
| 4579 | { | ||
| 4580 | ✗ | return qe_invalid; | |
| 4581 | } | ||
| 4582 | } | ||
| 4583 | |||
| 4584 |
2/4✓ Branch 0 taken 219968 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 219968 times.
✗ Branch 3 not taken.
|
219968 | if(!p_getc(&tempDMap.xoff,f)) |
| 4585 | { | ||
| 4586 | ✗ | return qe_invalid; | |
| 4587 | } | ||
| 4588 | |||
| 4589 |
2/4✓ Branch 0 taken 219968 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 219968 times.
✗ Branch 3 not taken.
|
219968 | if(!p_getc(&tempDMap.compass,f)) |
| 4590 | { | ||
| 4591 | ✗ | return qe_invalid; | |
| 4592 | } | ||
| 4593 | |||
| 4594 |
2/2✓ Branch 0 taken 202752 times.
✓ Branch 1 taken 17216 times.
|
219968 | if(s_version > 8) // February 2009 |
| 4595 | { | ||
| 4596 |
2/4✓ Branch 0 taken 202752 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 202752 times.
✗ Branch 3 not taken.
|
202752 | if(!p_igetw(&tempDMap.color,f)) |
| 4597 | { | ||
| 4598 | ✗ | return qe_invalid; | |
| 4599 | } | ||
| 4600 | 202752 | } | |
| 4601 | else | ||
| 4602 | { | ||
| 4603 | byte tempbyte; | ||
| 4604 | |||
| 4605 |
2/4✓ Branch 0 taken 17216 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 17216 times.
✗ Branch 3 not taken.
|
17216 | if(!p_getc(&tempbyte,f)) |
| 4606 | { | ||
| 4607 | ✗ | return qe_invalid; | |
| 4608 | } | ||
| 4609 | |||
| 4610 | 17216 | tempDMap.color = (word)tempbyte; | |
| 4611 | } | ||
| 4612 | |||
| 4613 |
2/4✓ Branch 0 taken 219968 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 219968 times.
✗ Branch 3 not taken.
|
219968 | if(!p_getc(&tempDMap.midi,f)) |
| 4614 | { | ||
| 4615 | ✗ | return qe_invalid; | |
| 4616 | } | ||
| 4617 | |||
| 4618 |
2/4✓ Branch 0 taken 219968 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 219968 times.
✗ Branch 3 not taken.
|
219968 | if(!p_getc(&tempDMap.cont,f)) |
| 4619 | { | ||
| 4620 | ✗ | return qe_invalid; | |
| 4621 | } | ||
| 4622 | |||
| 4623 |
2/4✓ Branch 0 taken 219968 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 219968 times.
✗ Branch 3 not taken.
|
219968 | if(!p_getc(&tempDMap.type,f)) |
| 4624 | { | ||
| 4625 | ✗ | return qe_invalid; | |
| 4626 | } | ||
| 4627 | |||
| 4628 |
4/4✓ Branch 0 taken 5910 times.
✓ Branch 1 taken 214058 times.
✓ Branch 2 taken 5866 times.
✓ Branch 3 taken 44 times.
|
225878 | if((tempDMap.type & dmfTYPE) == dmOVERW && |
| 4629 |
1/2✓ Branch 0 taken 5910 times.
✗ Branch 1 not taken.
|
5910 | (!Header || Header->zelda_version >= 0x210)) // Not sure exactly when this changed |
| 4630 | 5866 | tempDMap.xoff = 0; | |
| 4631 | |||
| 4632 |
2/2✓ Branch 0 taken 219968 times.
✓ Branch 1 taken 1759744 times.
|
1979712 | for(int32_t j=0; j<8; j++) |
| 4633 | { | ||
| 4634 |
2/4✓ Branch 0 taken 1759744 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1759744 times.
✗ Branch 3 not taken.
|
1759744 | if(!p_getc(&tempDMap.grid[j],f)) |
| 4635 | { | ||
| 4636 | ✗ | return qe_invalid; | |
| 4637 | } | ||
| 4638 | 1759744 | } | |
| 4639 | |||
| 4640 |
5/6✓ Branch 0 taken 219968 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 219392 times.
✓ Branch 3 taken 576 times.
✓ Branch 4 taken 1536 times.
✓ Branch 5 taken 217856 times.
|
219968 | if(Header && ((Header->zelda_version < 0x192)||((Header->zelda_version == 0x192)&&(Header->build<41)))) |
| 4641 | { | ||
| 4642 |
4/4✓ Branch 0 taken 137 times.
✓ Branch 1 taken 1975 times.
✓ Branch 2 taken 10 times.
✓ Branch 3 taken 127 times.
|
2112 | if(tempDMap.level>0&&tempDMap.level<10) |
| 4643 | { | ||
| 4644 | 127 | sprintf(legacy_title,"LEVEL-%d ", tempDMap.level); | |
| 4645 | 127 | } | |
| 4646 |
2/2✓ Branch 0 taken 576 times.
✓ Branch 1 taken 1536 times.
|
2112 | tempDMap.title.assign(legacy_title); |
| 4647 | |||
| 4648 |
3/4✓ Branch 0 taken 18 times.
✓ Branch 1 taken 558 times.
✓ Branch 2 taken 18 times.
✗ Branch 3 not taken.
|
576 | if(i==0 && Header->zelda_version <= 0x190) |
| 4649 | { | ||
| 4650 |
1/2✓ Branch 0 taken 18 times.
✗ Branch 1 not taken.
|
18 | tempDMap.cont = std::max((int)tempDMap.cont - tempDMap.xoff, 0); |
| 4651 |
1/2✓ Branch 0 taken 18 times.
✗ Branch 1 not taken.
|
18 | tempDMap.compass = std::max((int)tempDMap.compass - tempDMap.xoff, 0); |
| 4652 | 18 | } | |
| 4653 | |||
| 4654 | //forgotten -DD | ||
| 4655 |
2/2✓ Branch 0 taken 137 times.
✓ Branch 1 taken 439 times.
|
576 | if(tempDMap.level==0) |
| 4656 | { | ||
| 4657 | 439 | tempDMap.flags=dmfCAVES|dmf3STAIR|dmfWHIRLWIND|dmfGUYCAVES; | |
| 4658 | 439 | } | |
| 4659 | 576 | } | |
| 4660 | else | ||
| 4661 | { | ||
| 4662 |
3/4✓ Branch 0 taken 219392 times.
✓ Branch 1 taken 1536 times.
✓ Branch 2 taken 219392 times.
✗ Branch 3 not taken.
|
217856 | if(!p_getstr(tempDMap.name,sizeof(DMaps[0].name) - 1,f)) |
| 4663 | { | ||
| 4664 | ✗ | return qe_invalid; | |
| 4665 | } | ||
| 4666 | |||
| 4667 |
2/2✓ Branch 0 taken 127232 times.
✓ Branch 1 taken 92160 times.
|
219392 | if(s_version<20) |
| 4668 | { | ||
| 4669 |
2/4✓ Branch 0 taken 127232 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 127232 times.
✗ Branch 3 not taken.
|
127232 | if (!p_getstr(legacy_title, sizeof(legacy_title) - 1, f)) |
| 4670 | { | ||
| 4671 | ✗ | return qe_invalid; | |
| 4672 | } | ||
| 4673 |
1/2✓ Branch 0 taken 127232 times.
✗ Branch 1 not taken.
|
127232 | tempDMap.title.assign(legacy_title); |
| 4674 | 127232 | } | |
| 4675 | else | ||
| 4676 | { | ||
| 4677 |
2/4✓ Branch 0 taken 92160 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 92160 times.
✗ Branch 3 not taken.
|
92160 | if (!p_getwstr(&tempDMap.title, f)) |
| 4678 | { | ||
| 4679 | ✗ | return qe_invalid; | |
| 4680 | } | ||
| 4681 | } | ||
| 4682 | |||
| 4683 |
2/4✓ Branch 0 taken 219392 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 219392 times.
✗ Branch 3 not taken.
|
219392 | if(!p_getstr(tempDMap.intro,sizeof(DMaps[0].intro)-1,f)) |
| 4684 | { | ||
| 4685 | ✗ | return qe_invalid; | |
| 4686 | } | ||
| 4687 | |||
| 4688 |
5/8✓ Branch 0 taken 219392 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 219392 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1536 times.
✓ Branch 5 taken 217856 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 1536 times.
|
219392 | if(Header && ((Header->zelda_version < 0x192)||((Header->zelda_version == 0x192)&&(Header->build<152)))) |
| 4689 | { | ||
| 4690 | ✗ | if ((tempDMap.type & dmfTYPE) == dmOVERW) tempDMap.flags = dmfCAVES | dmf3STAIR | dmfWHIRLWIND | dmfGUYCAVES; | |
| 4691 | ✗ | DMaps[i] = tempDMap; | |
| 4692 | |||
| 4693 | ✗ | continue; | |
| 4694 | } | ||
| 4695 | |||
| 4696 |
3/4✓ Branch 0 taken 219392 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1536 times.
✓ Branch 3 taken 217856 times.
|
219392 | if(Header && (Header->zelda_version < 0x193)) |
| 4697 | { | ||
| 4698 |
2/4✓ Branch 0 taken 1536 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1536 times.
✗ Branch 3 not taken.
|
1536 | if(!p_getc(&padding,f)) |
| 4699 | { | ||
| 4700 | ✗ | return qe_invalid; | |
| 4701 | } | ||
| 4702 | 1536 | } | |
| 4703 |
2/2✓ Branch 0 taken 100352 times.
✓ Branch 1 taken 119040 times.
|
219392 | if ( s_version >= 11 ) |
| 4704 | { | ||
| 4705 |
2/4✓ Branch 0 taken 100352 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 100352 times.
✗ Branch 3 not taken.
|
100352 | if(!p_igetl(&tempDMap.minimap_tile[0],f)) |
| 4706 | { | ||
| 4707 | ✗ | return qe_invalid; | |
| 4708 | } | ||
| 4709 | 100352 | } | |
| 4710 | else | ||
| 4711 | { | ||
| 4712 |
2/4✓ Branch 0 taken 119040 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 119040 times.
✗ Branch 3 not taken.
|
119040 | if(!p_igetw(&tempDMap.minimap_tile[0],f)) |
| 4713 | { | ||
| 4714 | ✗ | return qe_invalid; | |
| 4715 | } | ||
| 4716 | } | ||
| 4717 | |||
| 4718 |
2/4✓ Branch 0 taken 219392 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 219392 times.
✗ Branch 3 not taken.
|
219392 | if(!p_getc(&tempDMap.minimap_cset[0],f)) |
| 4719 | { | ||
| 4720 | ✗ | return qe_invalid; | |
| 4721 | } | ||
| 4722 | |||
| 4723 |
3/4✓ Branch 0 taken 219392 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1536 times.
✓ Branch 3 taken 217856 times.
|
219392 | if(Header && (Header->zelda_version < 0x193)) |
| 4724 | { | ||
| 4725 |
2/4✓ Branch 0 taken 1536 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1536 times.
✗ Branch 3 not taken.
|
1536 | if(!p_getc(&padding,f)) |
| 4726 | { | ||
| 4727 | ✗ | return qe_invalid; | |
| 4728 | } | ||
| 4729 | 1536 | } | |
| 4730 | |||
| 4731 |
2/2✓ Branch 0 taken 100352 times.
✓ Branch 1 taken 119040 times.
|
219392 | if ( s_version >= 11 ) |
| 4732 | { | ||
| 4733 |
2/4✓ Branch 0 taken 100352 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 100352 times.
✗ Branch 3 not taken.
|
100352 | if(!p_igetl(&tempDMap.minimap_tile[1],f)) |
| 4734 | { | ||
| 4735 | ✗ | return qe_invalid; | |
| 4736 | } | ||
| 4737 | 100352 | } | |
| 4738 | else | ||
| 4739 | { | ||
| 4740 |
2/4✓ Branch 0 taken 119040 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 119040 times.
✗ Branch 3 not taken.
|
119040 | if(!p_igetw(&tempDMap.minimap_tile[1],f)) |
| 4741 | { | ||
| 4742 | ✗ | return qe_invalid; | |
| 4743 | } | ||
| 4744 | } | ||
| 4745 |
2/4✓ Branch 0 taken 219392 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 219392 times.
✗ Branch 3 not taken.
|
219392 | if(!p_getc(&tempDMap.minimap_cset[1],f)) |
| 4746 | { | ||
| 4747 | ✗ | return qe_invalid; | |
| 4748 | } | ||
| 4749 | |||
| 4750 |
3/4✓ Branch 0 taken 219392 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1536 times.
✓ Branch 3 taken 217856 times.
|
219392 | if(Header && (Header->zelda_version < 0x193)) |
| 4751 | { | ||
| 4752 |
2/4✓ Branch 0 taken 1536 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1536 times.
✗ Branch 3 not taken.
|
1536 | if(!p_getc(&padding,f)) |
| 4753 | { | ||
| 4754 | ✗ | return qe_invalid; | |
| 4755 | } | ||
| 4756 | 1536 | } | |
| 4757 | |||
| 4758 |
2/2✓ Branch 0 taken 100352 times.
✓ Branch 1 taken 119040 times.
|
219392 | if ( s_version >= 11 ) |
| 4759 | { | ||
| 4760 |
2/4✓ Branch 0 taken 100352 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 100352 times.
✗ Branch 3 not taken.
|
100352 | if(!p_igetl(&tempDMap.largemap_tile[0],f)) |
| 4761 | { | ||
| 4762 | ✗ | return qe_invalid; | |
| 4763 | } | ||
| 4764 | 100352 | } | |
| 4765 | else | ||
| 4766 | { | ||
| 4767 |
2/4✓ Branch 0 taken 119040 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 119040 times.
✗ Branch 3 not taken.
|
119040 | if(!p_igetw(&tempDMap.largemap_tile[0],f)) |
| 4768 | { | ||
| 4769 | ✗ | return qe_invalid; | |
| 4770 | } | ||
| 4771 | } | ||
| 4772 | |||
| 4773 |
2/4✓ Branch 0 taken 219392 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 219392 times.
✗ Branch 3 not taken.
|
219392 | if(!p_getc(&tempDMap.largemap_cset[0],f)) |
| 4774 | { | ||
| 4775 | ✗ | return qe_invalid; | |
| 4776 | } | ||
| 4777 | |||
| 4778 |
3/4✓ Branch 0 taken 219392 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1536 times.
✓ Branch 3 taken 217856 times.
|
219392 | if(Header && (Header->zelda_version < 0x193)) |
| 4779 | { | ||
| 4780 | |||
| 4781 |
2/4✓ Branch 0 taken 1536 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1536 times.
✗ Branch 3 not taken.
|
1536 | if(!p_getc(&padding,f)) |
| 4782 | { | ||
| 4783 | ✗ | return qe_invalid; | |
| 4784 | } | ||
| 4785 | 1536 | } | |
| 4786 | |||
| 4787 |
2/2✓ Branch 0 taken 100352 times.
✓ Branch 1 taken 119040 times.
|
219392 | if ( s_version >= 11 ) |
| 4788 | { | ||
| 4789 |
2/4✓ Branch 0 taken 100352 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 100352 times.
✗ Branch 3 not taken.
|
100352 | if(!p_igetl(&tempDMap.largemap_tile[1],f)) |
| 4790 | { | ||
| 4791 | ✗ | return qe_invalid; | |
| 4792 | } | ||
| 4793 | 100352 | } | |
| 4794 | else | ||
| 4795 | { | ||
| 4796 |
2/4✓ Branch 0 taken 119040 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 119040 times.
✗ Branch 3 not taken.
|
119040 | if(!p_igetw(&tempDMap.largemap_tile[1],f)) |
| 4797 | { | ||
| 4798 | ✗ | return qe_invalid; | |
| 4799 | } | ||
| 4800 | } | ||
| 4801 |
2/4✓ Branch 0 taken 219392 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 219392 times.
✗ Branch 3 not taken.
|
219392 | if(!p_getc(&tempDMap.largemap_cset[1],f)) |
| 4802 | { | ||
| 4803 | ✗ | return qe_invalid; | |
| 4804 | } | ||
| 4805 | |||
| 4806 |
2/4✓ Branch 0 taken 219392 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 219392 times.
✗ Branch 3 not taken.
|
219392 | if(!p_getstr(tempDMap.tmusic,sizeof(DMaps[0].tmusic)-1,f)) |
| 4807 | { | ||
| 4808 | ✗ | return qe_invalid; | |
| 4809 | } | ||
| 4810 | } | ||
| 4811 | |||
| 4812 |
2/2✓ Branch 0 taken 202752 times.
✓ Branch 1 taken 17216 times.
|
219968 | if(s_version>1) |
| 4813 | { | ||
| 4814 |
2/4✓ Branch 0 taken 202752 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 202752 times.
✗ Branch 3 not taken.
|
202752 | if(!p_getc(&tempDMap.tmusictrack,f)) |
| 4815 | { | ||
| 4816 | ✗ | return qe_invalid; | |
| 4817 | } | ||
| 4818 | |||
| 4819 |
2/4✓ Branch 0 taken 202752 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 202752 times.
✗ Branch 3 not taken.
|
202752 | if(!p_getc(&tempDMap.active_subscreen,f)) |
| 4820 | { | ||
| 4821 | ✗ | return qe_invalid; | |
| 4822 | } | ||
| 4823 | |||
| 4824 |
2/4✓ Branch 0 taken 202752 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 202752 times.
✗ Branch 3 not taken.
|
202752 | if(!p_getc(&tempDMap.passive_subscreen,f)) |
| 4825 | { | ||
| 4826 | ✗ | return qe_invalid; | |
| 4827 | } | ||
| 4828 | 202752 | } | |
| 4829 | |||
| 4830 |
2/2✓ Branch 0 taken 202752 times.
✓ Branch 1 taken 17216 times.
|
219968 | if(s_version>2) |
| 4831 | { | ||
| 4832 | byte di[32]; | ||
| 4833 | |||
| 4834 |
2/4✓ Branch 0 taken 202752 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 202752 times.
✗ Branch 3 not taken.
|
202752 | if(!pfread(&di, 32, f)) return qe_invalid; |
| 4835 | |||
| 4836 |
2/2✓ Branch 0 taken 51904512 times.
✓ Branch 1 taken 202752 times.
|
52107264 | for(int32_t j=0; j<MAXITEMS; j++) |
| 4837 | { | ||
| 4838 |
2/2✓ Branch 0 taken 9207 times.
✓ Branch 1 taken 51895305 times.
|
51904512 | if(di[j/8] & (1 << (j%8))) tempDMap.disableditems[j]=1; |
| 4839 | 51895305 | else tempDMap.disableditems[j]=0; | |
| 4840 | 51904512 | } | |
| 4841 | 202752 | } | |
| 4842 | |||
| 4843 |
2/2✓ Branch 0 taken 202752 times.
✓ Branch 1 taken 17216 times.
|
219968 | if(s_version >= 6) |
| 4844 | { | ||
| 4845 |
2/4✓ Branch 0 taken 202752 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 202752 times.
✗ Branch 3 not taken.
|
202752 | if(!p_igetl(&tempDMap.flags,f)) |
| 4846 | { | ||
| 4847 | ✗ | return qe_invalid; | |
| 4848 | } | ||
| 4849 | 202752 | } | |
| 4850 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 17216 times.
|
17216 | else if(s_version>3) |
| 4851 | { | ||
| 4852 | char temp; | ||
| 4853 | |||
| 4854 | ✗ | if(!p_getc(&temp,f)) | |
| 4855 | { | ||
| 4856 | ✗ | return qe_invalid; | |
| 4857 | } | ||
| 4858 | |||
| 4859 | ✗ | tempDMap.flags = temp; | |
| 4860 | ✗ | } | |
| 4861 |
3/8✓ Branch 0 taken 8992 times.
✓ Branch 1 taken 8224 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 8992 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
17216 | else if(tempDMap.level==0 && ((Header->zelda_version < 0x211) || ((Header->zelda_version == 0x211) && (Header->build<18)))) |
| 4862 | { | ||
| 4863 | 8992 | tempDMap.flags=dmfCAVES|dmf3STAIR|dmfWHIRLWIND|dmfGUYCAVES; | |
| 4864 | 8992 | } | |
| 4865 | else | ||
| 4866 | 8224 | tempDMap.flags=0; | |
| 4867 | |||
| 4868 |
2/2✓ Branch 0 taken 202752 times.
✓ Branch 1 taken 17216 times.
|
219968 | if(s_version<7) |
| 4869 | { | ||
| 4870 |
5/6✓ Branch 0 taken 8992 times.
✓ Branch 1 taken 8224 times.
✓ Branch 2 taken 8992 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 2846 times.
✓ Branch 5 taken 6146 times.
|
17216 | if(tempDMap.level==0 && get_bit(deprecated_rules,14)) |
| 4871 | 6146 | tempDMap.flags|= dmfVIEWMAP; | |
| 4872 | 17216 | } | |
| 4873 | |||
| 4874 |
2/2✓ Branch 0 taken 202752 times.
✓ Branch 1 taken 17216 times.
|
219968 | if(s_version<8) |
| 4875 | { | ||
| 4876 |
4/4✓ Branch 0 taken 8992 times.
✓ Branch 1 taken 8224 times.
✓ Branch 2 taken 8050 times.
✓ Branch 3 taken 942 times.
|
17216 | if(tempDMap.level==0 && (tempDMap.type&dmfTYPE)==dmDNGN) |
| 4877 | { | ||
| 4878 |
1/2✓ Branch 0 taken 8050 times.
✗ Branch 1 not taken.
|
8050 | tempDMap.type &= ~dmDNGN; |
| 4879 | 8050 | tempDMap.type |= dmCAVE; | |
| 4880 | 8050 | } | |
| 4881 |
2/2✓ Branch 0 taken 6834 times.
✓ Branch 1 taken 2332 times.
|
9166 | else if((tempDMap.type&dmfTYPE)==dmCAVE) |
| 4882 | { | ||
| 4883 | 2332 | tempDMap.flags |= dmfMINIMAPCOLORFIX; | |
| 4884 | 2332 | } | |
| 4885 | 17216 | } | |
| 4886 | |||
| 4887 |
7/8✓ Branch 0 taken 219968 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2112 times.
✓ Branch 3 taken 217856 times.
✓ Branch 4 taken 1536 times.
✓ Branch 5 taken 576 times.
✓ Branch 6 taken 1536 times.
✓ Branch 7 taken 217856 times.
|
219968 | if(Header && ((Header->zelda_version > 0x192)||((Header->zelda_version == 0x192)&&(Header->build>=41))) |
| 4888 | 219392 | && (Header->zelda_version < 0x193)) | |
| 4889 | { | ||
| 4890 |
2/4✓ Branch 0 taken 1536 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1536 times.
✗ Branch 3 not taken.
|
1536 | if(!p_getc(&padding,f)) |
| 4891 | { | ||
| 4892 | ✗ | return qe_invalid; | |
| 4893 | } | ||
| 4894 | 1536 | } | |
| 4895 | |||
| 4896 |
2/2✓ Branch 0 taken 119616 times.
✓ Branch 1 taken 100352 times.
|
219968 | if(s_version >= 10) |
| 4897 | { | ||
| 4898 |
2/4✓ Branch 0 taken 100352 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 100352 times.
✗ Branch 3 not taken.
|
100352 | if(!p_getc(&tempDMap.sideview,f)) |
| 4899 | { | ||
| 4900 | ✗ | return qe_invalid; | |
| 4901 | } | ||
| 4902 | 100352 | } | |
| 4903 |
2/2✓ Branch 0 taken 100352 times.
✓ Branch 1 taken 119616 times.
|
219968 | if(s_version < 10) tempDMap.sideview = 0; |
| 4904 | |||
| 4905 | //Dmap Scripts | ||
| 4906 |
2/2✓ Branch 0 taken 100352 times.
✓ Branch 1 taken 119616 times.
|
219968 | if(s_version >= 12) |
| 4907 | { | ||
| 4908 |
2/4✓ Branch 0 taken 100352 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 100352 times.
✗ Branch 3 not taken.
|
100352 | if(!p_igetw(&tempDMap.script,f)) |
| 4909 | { | ||
| 4910 | ✗ | return qe_invalid; | |
| 4911 | } | ||
| 4912 |
2/2✓ Branch 0 taken 802816 times.
✓ Branch 1 taken 100352 times.
|
903168 | for ( int32_t q = 0; q < 8; q++ ) |
| 4913 | { | ||
| 4914 |
2/4✓ Branch 0 taken 802816 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 802816 times.
✗ Branch 3 not taken.
|
802816 | if(!p_igetl(&tempDMap.initD[q],f)) |
| 4915 | { | ||
| 4916 | ✗ | return qe_invalid; | |
| 4917 | } | ||
| 4918 | 802816 | } | |
| 4919 | 100352 | } | |
| 4920 |
2/2✓ Branch 0 taken 100352 times.
✓ Branch 1 taken 119616 times.
|
219968 | if ( s_version < 12 ) |
| 4921 | { | ||
| 4922 | 119616 | tempDMap.script = 0; | |
| 4923 |
2/2✓ Branch 0 taken 956928 times.
✓ Branch 1 taken 119616 times.
|
1076544 | for ( int32_t q = 0; q < 8; q++ ) |
| 4924 | { | ||
| 4925 | 956928 | tempDMap.initD[q] = 0; | |
| 4926 | 956928 | } | |
| 4927 | 119616 | } | |
| 4928 | |||
| 4929 |
2/2✓ Branch 0 taken 119616 times.
✓ Branch 1 taken 100352 times.
|
219968 | if(s_version >= 13) |
| 4930 | { | ||
| 4931 |
2/2✓ Branch 0 taken 802816 times.
✓ Branch 1 taken 100352 times.
|
903168 | for ( int32_t q = 0; q < 8; q++ ) |
| 4932 | { | ||
| 4933 |
2/2✓ Branch 0 taken 52183040 times.
✓ Branch 1 taken 802816 times.
|
52985856 | for ( int32_t w = 0; w < 65; w++ ) |
| 4934 | { | ||
| 4935 |
2/4✓ Branch 0 taken 52183040 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 52183040 times.
✗ Branch 3 not taken.
|
52183040 | if(!p_getc(&tempDMap.initD_label[q][w],f)) |
| 4936 | { | ||
| 4937 | ✗ | return qe_invalid; | |
| 4938 | } | ||
| 4939 | 52183040 | } | |
| 4940 | 802816 | } | |
| 4941 | 100352 | } | |
| 4942 |
2/2✓ Branch 0 taken 100352 times.
✓ Branch 1 taken 119616 times.
|
219968 | if ( s_version < 13 ) |
| 4943 | { | ||
| 4944 | 119616 | tempDMap.script = 0; | |
| 4945 |
2/2✓ Branch 0 taken 956928 times.
✓ Branch 1 taken 119616 times.
|
1076544 | for ( int32_t q = 0; q < 8; q++ ) |
| 4946 | { | ||
| 4947 |
2/2✓ Branch 0 taken 62200320 times.
✓ Branch 1 taken 956928 times.
|
63157248 | for ( int32_t w = 0; w < 65; w++ ) |
| 4948 | 62200320 | tempDMap.initD_label[q][w] = 0; | |
| 4949 | 956928 | } | |
| 4950 | 119616 | } | |
| 4951 |
2/2✓ Branch 0 taken 100352 times.
✓ Branch 1 taken 119616 times.
|
219968 | if(s_version >= 14) |
| 4952 | { | ||
| 4953 |
2/4✓ Branch 0 taken 100352 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 100352 times.
✗ Branch 3 not taken.
|
100352 | if(!p_igetw(&tempDMap.active_sub_script,f)) |
| 4954 | { | ||
| 4955 | ✗ | return qe_invalid; | |
| 4956 | } | ||
| 4957 |
2/4✓ Branch 0 taken 100352 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 100352 times.
✗ Branch 3 not taken.
|
100352 | if(!p_igetw(&tempDMap.passive_sub_script,f)) |
| 4958 | { | ||
| 4959 | ✗ | return qe_invalid; | |
| 4960 | } | ||
| 4961 |
2/2✓ Branch 0 taken 802816 times.
✓ Branch 1 taken 100352 times.
|
903168 | for ( int32_t q = 0; q < 8; ++q ) |
| 4962 | { | ||
| 4963 |
2/4✓ Branch 0 taken 802816 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 802816 times.
✗ Branch 3 not taken.
|
802816 | if(!p_igetl(&tempDMap.sub_initD[q],f)) |
| 4964 | { | ||
| 4965 | ✗ | return qe_invalid; | |
| 4966 | } | ||
| 4967 | 802816 | } | |
| 4968 |
2/2✓ Branch 0 taken 802816 times.
✓ Branch 1 taken 100352 times.
|
903168 | for(int32_t q = 0; q < 8; ++q) |
| 4969 | { | ||
| 4970 |
2/2✓ Branch 0 taken 52183040 times.
✓ Branch 1 taken 802816 times.
|
52985856 | for ( int32_t w = 0; w < 65; ++w ) |
| 4971 | { | ||
| 4972 |
2/4✓ Branch 0 taken 52183040 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 52183040 times.
✗ Branch 3 not taken.
|
52183040 | if(!p_getc(&tempDMap.sub_initD_label[q][w],f)) |
| 4973 | { | ||
| 4974 | ✗ | return qe_invalid; | |
| 4975 | } | ||
| 4976 | 52183040 | } | |
| 4977 | 802816 | } | |
| 4978 | 100352 | } | |
| 4979 | else | ||
| 4980 | { | ||
| 4981 | 119616 | tempDMap.active_sub_script = 0; | |
| 4982 | 119616 | tempDMap.passive_sub_script = 0; | |
| 4983 |
2/2✓ Branch 0 taken 956928 times.
✓ Branch 1 taken 119616 times.
|
1076544 | for(int32_t q = 0; q < 8; ++q) |
| 4984 | { | ||
| 4985 | 956928 | tempDMap.sub_initD[q] = 0; | |
| 4986 |
2/2✓ Branch 0 taken 62200320 times.
✓ Branch 1 taken 956928 times.
|
63157248 | for(int32_t w = 0; w < 65; ++w) |
| 4987 | 62200320 | tempDMap.sub_initD_label[q][w] = 0; | |
| 4988 | 956928 | } | |
| 4989 | } | ||
| 4990 |
2/2✓ Branch 0 taken 100352 times.
✓ Branch 1 taken 119616 times.
|
219968 | if(s_version >= 15) |
| 4991 | { | ||
| 4992 |
2/4✓ Branch 0 taken 100352 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 100352 times.
✗ Branch 3 not taken.
|
100352 | if(!p_igetw(&tempDMap.onmap_script,f)) |
| 4993 | { | ||
| 4994 | ✗ | return qe_invalid; | |
| 4995 | } | ||
| 4996 |
2/2✓ Branch 0 taken 802816 times.
✓ Branch 1 taken 100352 times.
|
903168 | for ( int32_t q = 0; q < 8; ++q ) |
| 4997 | { | ||
| 4998 |
2/4✓ Branch 0 taken 802816 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 802816 times.
✗ Branch 3 not taken.
|
802816 | if(!p_igetl(&tempDMap.onmap_initD[q],f)) |
| 4999 | { | ||
| 5000 | ✗ | return qe_invalid; | |
| 5001 | } | ||
| 5002 | 802816 | } | |
| 5003 |
2/2✓ Branch 0 taken 802816 times.
✓ Branch 1 taken 100352 times.
|
903168 | for(int32_t q = 0; q < 8; ++q) |
| 5004 | { | ||
| 5005 |
2/2✓ Branch 0 taken 52183040 times.
✓ Branch 1 taken 802816 times.
|
52985856 | for ( int32_t w = 0; w < 65; ++w ) |
| 5006 | { | ||
| 5007 |
2/4✓ Branch 0 taken 52183040 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 52183040 times.
✗ Branch 3 not taken.
|
52183040 | if(!p_getc(&tempDMap.onmap_initD_label[q][w],f)) |
| 5008 | { | ||
| 5009 | ✗ | return qe_invalid; | |
| 5010 | } | ||
| 5011 | 52183040 | } | |
| 5012 | 802816 | } | |
| 5013 | 100352 | } | |
| 5014 | else | ||
| 5015 | { | ||
| 5016 | 119616 | tempDMap.onmap_script = 0; | |
| 5017 |
2/2✓ Branch 0 taken 956928 times.
✓ Branch 1 taken 119616 times.
|
1076544 | for(int32_t q = 0; q < 8; ++q) |
| 5018 | { | ||
| 5019 | 956928 | tempDMap.onmap_initD[q] = 0; | |
| 5020 |
2/2✓ Branch 0 taken 62200320 times.
✓ Branch 1 taken 956928 times.
|
63157248 | for(int32_t w = 0; w < 65; ++w) |
| 5021 | { | ||
| 5022 | 62200320 | tempDMap.onmap_initD_label[q][w] = 0; | |
| 5023 | 62200320 | } | |
| 5024 | 956928 | } | |
| 5025 | } | ||
| 5026 |
2/2✓ Branch 0 taken 100352 times.
✓ Branch 1 taken 119616 times.
|
219968 | if(s_version >= 16) |
| 5027 | { | ||
| 5028 |
2/4✓ Branch 0 taken 100352 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 100352 times.
✗ Branch 3 not taken.
|
100352 | if(!p_igetw(&tempDMap.mirrorDMap,f)) |
| 5029 | { | ||
| 5030 | ✗ | return qe_invalid; | |
| 5031 | } | ||
| 5032 | 100352 | } | |
| 5033 | else | ||
| 5034 | { | ||
| 5035 | 119616 | tempDMap.mirrorDMap = -1; | |
| 5036 | } | ||
| 5037 | |||
| 5038 | // Enhanced music loop points | ||
| 5039 |
2/2✓ Branch 0 taken 92160 times.
✓ Branch 1 taken 127808 times.
|
219968 | if (s_version >= 18) |
| 5040 | { | ||
| 5041 |
2/4✓ Branch 0 taken 92160 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 92160 times.
✗ Branch 3 not taken.
|
92160 | if (!p_igetl(&tempDMap.tmusic_loop_start, f)) |
| 5042 | { | ||
| 5043 | ✗ | return qe_invalid; | |
| 5044 | } | ||
| 5045 |
2/4✓ Branch 0 taken 92160 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 92160 times.
✗ Branch 3 not taken.
|
92160 | if (!p_igetl(&tempDMap.tmusic_loop_end, f)) |
| 5046 | { | ||
| 5047 | ✗ | return qe_invalid; | |
| 5048 | } | ||
| 5049 |
2/4✓ Branch 0 taken 92160 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 92160 times.
✗ Branch 3 not taken.
|
92160 | if (!p_igetl(&tempDMap.tmusic_xfade_in, f)) |
| 5050 | { | ||
| 5051 | ✗ | return qe_invalid; | |
| 5052 | } | ||
| 5053 |
2/4✓ Branch 0 taken 92160 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 92160 times.
✗ Branch 3 not taken.
|
92160 | if (!p_igetl(&tempDMap.tmusic_xfade_out, f)) |
| 5054 | { | ||
| 5055 | ✗ | return qe_invalid; | |
| 5056 | } | ||
| 5057 | 92160 | } | |
| 5058 | else | ||
| 5059 | { | ||
| 5060 | 127808 | tempDMap.tmusic_loop_start = 0; | |
| 5061 | 127808 | tempDMap.tmusic_loop_end = 0; | |
| 5062 | 127808 | tempDMap.tmusic_xfade_in = 0; | |
| 5063 | 127808 | tempDMap.tmusic_xfade_out = 0; | |
| 5064 | } | ||
| 5065 | |||
| 5066 |
2/2✓ Branch 0 taken 92160 times.
✓ Branch 1 taken 127808 times.
|
219968 | if(s_version >= 19) |
| 5067 |
2/4✓ Branch 0 taken 92160 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 92160 times.
✗ Branch 3 not taken.
|
92160 | if(!p_getc(&tempDMap.overlay_subscreen, f)) |
| 5068 | ✗ | return qe_invalid; | |
| 5069 | |||
| 5070 |
2/2✓ Branch 0 taken 92160 times.
✓ Branch 1 taken 127808 times.
|
219968 | if (s_version >= 20) |
| 5071 | { | ||
| 5072 |
2/4✓ Branch 0 taken 92160 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 92160 times.
✗ Branch 3 not taken.
|
92160 | if (!p_igetl(&tempDMap.intro_string_id, f)) |
| 5073 | ✗ | return qe_invalid; | |
| 5074 | 92160 | } | |
| 5075 | else | ||
| 5076 | 127808 | tempDMap.intro_string_id = 0; | |
| 5077 | |||
| 5078 |
2/2✓ Branch 0 taken 205632 times.
✓ Branch 1 taken 14336 times.
|
219968 | if(s_version == 21) |
| 5079 | { | ||
| 5080 | static regions_data tmp_rd; | ||
| 5081 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 14336 times.
|
14336 | regions_data& rd = should_skip ? tmp_rd : Regions[tempDMap.map]; |
| 5082 |
2/2✓ Branch 0 taken 114688 times.
✓ Branch 1 taken 14336 times.
|
129024 | for(int32_t j=0; j<8; j++) |
| 5083 | { | ||
| 5084 |
2/2✓ Branch 0 taken 917504 times.
✓ Branch 1 taken 114688 times.
|
1032192 | for(int32_t k=0; k<8; k++) |
| 5085 | { | ||
| 5086 |
2/4✓ Branch 0 taken 917504 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 917504 times.
✗ Branch 3 not taken.
|
917504 | if(!p_getc(&rd.region_ids[j][k],f)) |
| 5087 | { | ||
| 5088 | ✗ | return qe_invalid; | |
| 5089 | } | ||
| 5090 | 917504 | } | |
| 5091 | 114688 | } | |
| 5092 | 14336 | } | |
| 5093 | |||
| 5094 |
2/2✓ Branch 0 taken 219712 times.
✓ Branch 1 taken 256 times.
|
219968 | if (!should_skip) |
| 5095 | { | ||
| 5096 |
1/2✓ Branch 0 taken 219712 times.
✗ Branch 1 not taken.
|
219712 | if(loading_tileset_flags & TILESET_CLEARMAPS) |
| 5097 | ✗ | tempDMap.map = 0; | |
| 5098 |
1/2✓ Branch 0 taken 219712 times.
✗ Branch 1 not taken.
|
219712 | if(loading_tileset_flags & TILESET_CLEARSCRIPTS) |
| 5099 | { | ||
| 5100 | ✗ | tempDMap.script = 0; | |
| 5101 | ✗ | for(int q = 0; q < 8; ++q) | |
| 5102 | ✗ | tempDMap.initD[q] = 0; | |
| 5103 | ✗ | } | |
| 5104 |
1/2✓ Branch 0 taken 219712 times.
✗ Branch 1 not taken.
|
219712 | DMaps[i] = tempDMap; |
| 5105 | 219712 | } | |
| 5106 | 219968 | } | |
| 5107 | |||
| 5108 | 479 | return 0; | |
| 5109 | 6623 | } | |
| 5110 | |||
| 5111 | 396 | int32_t readmisccolors(PACKFILE *f, zquestheader *Header, miscQdata *Misc) | |
| 5112 | { | ||
| 5113 | //these are here to bypass compiler warnings about unused arguments | ||
| 5114 | 396 | Header=Header; | |
| 5115 | |||
| 5116 | miscQdata temp_misc; | ||
| 5117 | 396 | word s_version=0; | |
| 5118 | 396 | int32_t tempsize=0; | |
| 5119 | word dummyw; | ||
| 5120 | |||
| 5121 | 396 | memcpy(&temp_misc,Misc,sizeof(temp_misc)); | |
| 5122 | |||
| 5123 | //section version info | ||
| 5124 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 396 times.
|
396 | if(!p_igetw(&s_version,f)) |
| 5125 | { | ||
| 5126 | ✗ | return qe_invalid; | |
| 5127 | } | ||
| 5128 | |||
| 5129 | 396 | FFCore.quest_format[vColours] = s_version; | |
| 5130 | |||
| 5131 | 396 | al_trace("Misc Colours section version: %d\n", s_version); | |
| 5132 | |||
| 5133 |
1/2✓ Branch 0 taken 396 times.
✗ Branch 1 not taken.
|
396 | if(!read_deprecated_section_cversion(f)) |
| 5134 | { | ||
| 5135 | ✗ | return qe_invalid; | |
| 5136 | } | ||
| 5137 | |||
| 5138 | |||
| 5139 | //section size | ||
| 5140 |
1/2✓ Branch 0 taken 396 times.
✗ Branch 1 not taken.
|
396 | if(!p_igetl(&tempsize,f)) |
| 5141 | { | ||
| 5142 | ✗ | return qe_invalid; | |
| 5143 | } | ||
| 5144 | |||
| 5145 | //finally... section data | ||
| 5146 | 396 | readsize=0; | |
| 5147 | |||
| 5148 |
1/2✓ Branch 0 taken 396 times.
✗ Branch 1 not taken.
|
396 | if(!p_getc(&temp_misc.colors.text,f)) |
| 5149 | { | ||
| 5150 | ✗ | return qe_invalid; | |
| 5151 | } | ||
| 5152 | |||
| 5153 |
1/2✓ Branch 0 taken 396 times.
✗ Branch 1 not taken.
|
396 | if(!p_getc(&temp_misc.colors.caption,f)) |
| 5154 | { | ||
| 5155 | ✗ | return qe_invalid; | |
| 5156 | } | ||
| 5157 | |||
| 5158 |
1/2✓ Branch 0 taken 396 times.
✗ Branch 1 not taken.
|
396 | if(!p_getc(&temp_misc.colors.overw_bg,f)) |
| 5159 | { | ||
| 5160 | ✗ | return qe_invalid; | |
| 5161 | } | ||
| 5162 | |||
| 5163 |
1/2✓ Branch 0 taken 396 times.
✗ Branch 1 not taken.
|
396 | if(!p_getc(&temp_misc.colors.dngn_bg,f)) |
| 5164 | { | ||
| 5165 | ✗ | return qe_invalid; | |
| 5166 | } | ||
| 5167 | |||
| 5168 |
1/2✓ Branch 0 taken 396 times.
✗ Branch 1 not taken.
|
396 | if(!p_getc(&temp_misc.colors.dngn_fg,f)) |
| 5169 | { | ||
| 5170 | ✗ | return qe_invalid; | |
| 5171 | } | ||
| 5172 | |||
| 5173 |
1/2✓ Branch 0 taken 396 times.
✗ Branch 1 not taken.
|
396 | if(!p_getc(&temp_misc.colors.cave_fg,f)) |
| 5174 | { | ||
| 5175 | ✗ | return qe_invalid; | |
| 5176 | } | ||
| 5177 | |||
| 5178 |
1/2✓ Branch 0 taken 396 times.
✗ Branch 1 not taken.
|
396 | if(!p_getc(&temp_misc.colors.bs_dk,f)) |
| 5179 | { | ||
| 5180 | ✗ | return qe_invalid; | |
| 5181 | } | ||
| 5182 | |||
| 5183 |
1/2✓ Branch 0 taken 396 times.
✗ Branch 1 not taken.
|
396 | if(!p_getc(&temp_misc.colors.bs_goal,f)) |
| 5184 | { | ||
| 5185 | ✗ | return qe_invalid; | |
| 5186 | } | ||
| 5187 | |||
| 5188 |
1/2✓ Branch 0 taken 396 times.
✗ Branch 1 not taken.
|
396 | if(!p_getc(&temp_misc.colors.compass_lt,f)) |
| 5189 | { | ||
| 5190 | ✗ | return qe_invalid; | |
| 5191 | } | ||
| 5192 | |||
| 5193 |
1/2✓ Branch 0 taken 396 times.
✗ Branch 1 not taken.
|
396 | if(!p_getc(&temp_misc.colors.compass_dk,f)) |
| 5194 | { | ||
| 5195 | ✗ | return qe_invalid; | |
| 5196 | } | ||
| 5197 | |||
| 5198 |
1/2✓ Branch 0 taken 396 times.
✗ Branch 1 not taken.
|
396 | if(!p_getc(&temp_misc.colors.subscr_bg,f)) |
| 5199 | { | ||
| 5200 | ✗ | return qe_invalid; | |
| 5201 | } | ||
| 5202 | |||
| 5203 |
1/2✓ Branch 0 taken 396 times.
✗ Branch 1 not taken.
|
396 | if(!p_getc(&temp_misc.colors.triframe_color,f)) |
| 5204 | { | ||
| 5205 | ✗ | return qe_invalid; | |
| 5206 | } | ||
| 5207 | |||
| 5208 |
1/2✓ Branch 0 taken 396 times.
✗ Branch 1 not taken.
|
396 | if(!p_getc(&temp_misc.colors.hero_dot,f)) |
| 5209 | { | ||
| 5210 | ✗ | return qe_invalid; | |
| 5211 | } | ||
| 5212 | |||
| 5213 |
1/2✓ Branch 0 taken 396 times.
✗ Branch 1 not taken.
|
396 | if(!p_getc(&temp_misc.colors.bmap_bg,f)) |
| 5214 | { | ||
| 5215 | ✗ | return qe_invalid; | |
| 5216 | } | ||
| 5217 | |||
| 5218 |
1/2✓ Branch 0 taken 396 times.
✗ Branch 1 not taken.
|
396 | if(!p_getc(&temp_misc.colors.bmap_fg,f)) |
| 5219 | { | ||
| 5220 | ✗ | return qe_invalid; | |
| 5221 | } | ||
| 5222 | |||
| 5223 |
1/2✓ Branch 0 taken 396 times.
✗ Branch 1 not taken.
|
396 | if(!p_getc(&temp_misc.colors.triforce_cset,f)) |
| 5224 | { | ||
| 5225 | ✗ | return qe_invalid; | |
| 5226 | } | ||
| 5227 | |||
| 5228 |
1/2✓ Branch 0 taken 396 times.
✗ Branch 1 not taken.
|
396 | if(!p_getc(&temp_misc.colors.triframe_cset,f)) |
| 5229 | { | ||
| 5230 | ✗ | return qe_invalid; | |
| 5231 | } | ||
| 5232 | |||
| 5233 |
1/2✓ Branch 0 taken 396 times.
✗ Branch 1 not taken.
|
396 | if(!p_getc(&temp_misc.colors.overworld_map_cset,f)) |
| 5234 | { | ||
| 5235 | ✗ | return qe_invalid; | |
| 5236 | } | ||
| 5237 | |||
| 5238 |
1/2✓ Branch 0 taken 396 times.
✗ Branch 1 not taken.
|
396 | if(!p_getc(&temp_misc.colors.dungeon_map_cset,f)) |
| 5239 | { | ||
| 5240 | ✗ | return qe_invalid; | |
| 5241 | } | ||
| 5242 | |||
| 5243 |
1/2✓ Branch 0 taken 396 times.
✗ Branch 1 not taken.
|
396 | if(!p_getc(&temp_misc.colors.blueframe_cset,f)) |
| 5244 | { | ||
| 5245 | ✗ | return qe_invalid; | |
| 5246 | } | ||
| 5247 |
2/2✓ Branch 0 taken 196 times.
✓ Branch 1 taken 200 times.
|
396 | if(s_version < 4) |
| 5248 | { | ||
| 5249 |
1/2✓ Branch 0 taken 200 times.
✗ Branch 1 not taken.
|
200 | if(!p_igetw(&dummyw,f)) |
| 5250 | ✗ | return qe_invalid; | |
| 5251 | 200 | temp_misc.colors.triforce_tile = dummyw; | |
| 5252 | |||
| 5253 |
1/2✓ Branch 0 taken 200 times.
✗ Branch 1 not taken.
|
200 | if(!p_igetw(&dummyw,f)) |
| 5254 | ✗ | return qe_invalid; | |
| 5255 | 200 | temp_misc.colors.triframe_tile = dummyw; | |
| 5256 | |||
| 5257 |
1/2✓ Branch 0 taken 200 times.
✗ Branch 1 not taken.
|
200 | if(!p_igetw(&dummyw,f)) |
| 5258 | ✗ | return qe_invalid; | |
| 5259 | 200 | temp_misc.colors.overworld_map_tile = dummyw; | |
| 5260 | |||
| 5261 |
1/2✓ Branch 0 taken 200 times.
✗ Branch 1 not taken.
|
200 | if(!p_igetw(&dummyw,f)) |
| 5262 | ✗ | return qe_invalid; | |
| 5263 | 200 | temp_misc.colors.dungeon_map_tile = dummyw; | |
| 5264 | |||
| 5265 |
1/2✓ Branch 0 taken 200 times.
✗ Branch 1 not taken.
|
200 | if(!p_igetw(&dummyw,f)) |
| 5266 | ✗ | return qe_invalid; | |
| 5267 | 200 | temp_misc.colors.blueframe_tile = dummyw; | |
| 5268 | |||
| 5269 |
1/2✓ Branch 0 taken 200 times.
✗ Branch 1 not taken.
|
200 | if(!p_igetw(&dummyw,f)) |
| 5270 | ✗ | return qe_invalid; | |
| 5271 | 200 | temp_misc.colors.HCpieces_tile = dummyw; | |
| 5272 | 200 | } | |
| 5273 | |||
| 5274 |
1/2✓ Branch 0 taken 396 times.
✗ Branch 1 not taken.
|
396 | if(!p_getc(&temp_misc.colors.HCpieces_cset,f)) |
| 5275 | { | ||
| 5276 | ✗ | return qe_invalid; | |
| 5277 | } | ||
| 5278 | |||
| 5279 |
1/2✓ Branch 0 taken 396 times.
✗ Branch 1 not taken.
|
396 | if(!p_getc(&temp_misc.colors.subscr_shadow,f)) |
| 5280 | { | ||
| 5281 | ✗ | return qe_invalid; | |
| 5282 | } | ||
| 5283 | |||
| 5284 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 396 times.
|
396 | if(s_version < 2) |
| 5285 | { | ||
| 5286 | ✗ | temp_misc.colors.msgtext = 0x01; | |
| 5287 | ✗ | } | |
| 5288 | else | ||
| 5289 | { | ||
| 5290 |
1/2✓ Branch 0 taken 396 times.
✗ Branch 1 not taken.
|
396 | if(!p_getc(&temp_misc.colors.msgtext, f)) |
| 5291 | { | ||
| 5292 | ✗ | return qe_invalid; | |
| 5293 | } | ||
| 5294 | } | ||
| 5295 | |||
| 5296 |
2/2✓ Branch 0 taken 200 times.
✓ Branch 1 taken 196 times.
|
396 | if ( s_version >= 3 ) //expanded tile pages to 825 |
| 5297 | { | ||
| 5298 |
1/2✓ Branch 0 taken 196 times.
✗ Branch 1 not taken.
|
196 | if(!p_igetl(&temp_misc.colors.triforce_tile,f)) |
| 5299 | { | ||
| 5300 | ✗ | return qe_invalid; | |
| 5301 | } | ||
| 5302 | |||
| 5303 |
1/2✓ Branch 0 taken 196 times.
✗ Branch 1 not taken.
|
196 | if(!p_igetl(&temp_misc.colors.triframe_tile,f)) |
| 5304 | { | ||
| 5305 | ✗ | return qe_invalid; | |
| 5306 | } | ||
| 5307 | |||
| 5308 |
1/2✓ Branch 0 taken 196 times.
✗ Branch 1 not taken.
|
196 | if(!p_igetl(&temp_misc.colors.overworld_map_tile,f)) |
| 5309 | { | ||
| 5310 | ✗ | return qe_invalid; | |
| 5311 | } | ||
| 5312 | |||
| 5313 |
1/2✓ Branch 0 taken 196 times.
✗ Branch 1 not taken.
|
196 | if(!p_igetl(&temp_misc.colors.dungeon_map_tile,f)) |
| 5314 | { | ||
| 5315 | ✗ | return qe_invalid; | |
| 5316 | } | ||
| 5317 | |||
| 5318 |
1/2✓ Branch 0 taken 196 times.
✗ Branch 1 not taken.
|
196 | if(!p_igetl(&temp_misc.colors.blueframe_tile,f)) |
| 5319 | { | ||
| 5320 | ✗ | return qe_invalid; | |
| 5321 | } | ||
| 5322 | |||
| 5323 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 196 times.
|
196 | if(!p_igetl(&temp_misc.colors.HCpieces_tile,f)) |
| 5324 | { | ||
| 5325 | ✗ | return qe_invalid; | |
| 5326 | } | ||
| 5327 | 196 | } | |
| 5328 | |||
| 5329 | 396 | memcpy(Misc, &temp_misc, sizeof(temp_misc)); | |
| 5330 | |||
| 5331 | 396 | return 0; | |
| 5332 | 396 | } | |
| 5333 | |||
| 5334 | 396 | int32_t readgameicons(PACKFILE *f, zquestheader *, miscQdata *Misc) | |
| 5335 | { | ||
| 5336 | miscQdata temp_misc; | ||
| 5337 | 396 | word s_version=0; | |
| 5338 | byte icons; | ||
| 5339 | 396 | int32_t tempsize=0; | |
| 5340 | |||
| 5341 | 396 | memcpy(&temp_misc,Misc,sizeof(temp_misc)); | |
| 5342 | |||
| 5343 | //section version info | ||
| 5344 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 396 times.
|
396 | if(!p_igetw(&s_version,f)) |
| 5345 | { | ||
| 5346 | ✗ | return qe_invalid; | |
| 5347 | } | ||
| 5348 | |||
| 5349 | 396 | FFCore.quest_format[vIcons] = s_version; | |
| 5350 | |||
| 5351 |
1/2✓ Branch 0 taken 396 times.
✗ Branch 1 not taken.
|
396 | if(!read_deprecated_section_cversion(f)) |
| 5352 | { | ||
| 5353 | ✗ | return qe_invalid; | |
| 5354 | } | ||
| 5355 | |||
| 5356 | |||
| 5357 | //section size | ||
| 5358 |
1/2✓ Branch 0 taken 396 times.
✗ Branch 1 not taken.
|
396 | if(!p_igetl(&tempsize,f)) |
| 5359 | { | ||
| 5360 | ✗ | return qe_invalid; | |
| 5361 | } | ||
| 5362 | |||
| 5363 | //finally... section data | ||
| 5364 | 396 | readsize=0; | |
| 5365 | |||
| 5366 | 396 | icons=4; | |
| 5367 | |||
| 5368 |
2/2✓ Branch 0 taken 196 times.
✓ Branch 1 taken 200 times.
|
396 | if ( s_version >= 10 ) |
| 5369 | { | ||
| 5370 |
2/2✓ Branch 0 taken 784 times.
✓ Branch 1 taken 196 times.
|
980 | for(int32_t i=0; i<icons; i++) |
| 5371 | { | ||
| 5372 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 784 times.
|
784 | if(!p_igetl(&temp_misc.icons[i],f)) |
| 5373 | { | ||
| 5374 | ✗ | return qe_invalid; | |
| 5375 | } | ||
| 5376 | 784 | } | |
| 5377 | 196 | } | |
| 5378 | else | ||
| 5379 | { | ||
| 5380 |
2/2✓ Branch 0 taken 800 times.
✓ Branch 1 taken 200 times.
|
1000 | for(int32_t i=0; i<icons; i++) |
| 5381 | { | ||
| 5382 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 800 times.
|
800 | if(!p_igetw(&temp_misc.icons[i],f)) |
| 5383 | { | ||
| 5384 | ✗ | return qe_invalid; | |
| 5385 | } | ||
| 5386 | 800 | } | |
| 5387 | } | ||
| 5388 | |||
| 5389 | 396 | memcpy(Misc, &temp_misc, sizeof(temp_misc)); | |
| 5390 | |||
| 5391 | 396 | return 0; | |
| 5392 | 396 | } | |
| 5393 | |||
| 5394 | 800 | int32_t readmisc(PACKFILE *f, zquestheader *Header, miscQdata *Misc) | |
| 5395 | { | ||
| 5396 |
2/2✓ Branch 0 taken 24 times.
✓ Branch 1 taken 776 times.
|
800 | bool should_skip = legacy_skip_flags && get_bit(legacy_skip_flags, skip_misc); |
| 5397 | |||
| 5398 | 800 | word maxinfos=256; | |
| 5399 | 800 | word maxshops=256; | |
| 5400 | 800 | word shops=16, infos=16, warprings=8, palcycles=256, windwarps=9, triforces=8, icons=4; | |
| 5401 | 800 | word ponds=16, pondsize=72, expansionsize=98*2; | |
| 5402 | byte tempbyte, padding; | ||
| 5403 | miscQdata temp_misc; | ||
| 5404 | 800 | word s_version=0; | |
| 5405 | word swaptmp; | ||
| 5406 | 800 | int32_t tempsize=0; | |
| 5407 | |||
| 5408 | 800 | memcpy(&temp_misc,Misc,sizeof(temp_misc)); | |
| 5409 | |||
| 5410 |
2/2✓ Branch 0 taken 204800 times.
✓ Branch 1 taken 800 times.
|
205600 | for(int32_t i=0; i<maxshops; ++i) |
| 5411 | { | ||
| 5412 | 204800 | memset(&temp_misc.shop, 0, sizeof(shoptype)*256); | |
| 5413 | 204800 | } | |
| 5414 | |||
| 5415 |
2/2✓ Branch 0 taken 204800 times.
✓ Branch 1 taken 800 times.
|
205600 | for(int32_t i=0; i<maxinfos; ++i) |
| 5416 | { | ||
| 5417 | 204800 | memset(&temp_misc.info, 0, sizeof(infotype)*256); | |
| 5418 | 204800 | } | |
| 5419 | |||
| 5420 | 800 | memset(&temp_misc.warp, 0, sizeof(temp_misc.warp)); | |
| 5421 | |||
| 5422 |
2/2✓ Branch 0 taken 24 times.
✓ Branch 1 taken 776 times.
|
800 | if(Header->zelda_version > 0x192) |
| 5423 | { | ||
| 5424 | //section version info | ||
| 5425 |
1/2✓ Branch 0 taken 776 times.
✗ Branch 1 not taken.
|
776 | if(!p_igetw(&s_version,f)) |
| 5426 | { | ||
| 5427 | ✗ | return qe_invalid; | |
| 5428 | } | ||
| 5429 | |||
| 5430 | 776 | FFCore.quest_format[vMisc] = s_version; | |
| 5431 | |||
| 5432 |
1/2✓ Branch 0 taken 776 times.
✗ Branch 1 not taken.
|
776 | if(!read_deprecated_section_cversion(f)) |
| 5433 | { | ||
| 5434 | ✗ | return qe_invalid; | |
| 5435 | } | ||
| 5436 | |||
| 5437 | |||
| 5438 | //section size | ||
| 5439 |
1/2✓ Branch 0 taken 776 times.
✗ Branch 1 not taken.
|
776 | if(!p_igetl(&tempsize,f)) |
| 5440 | { | ||
| 5441 | ✗ | return qe_invalid; | |
| 5442 | } | ||
| 5443 | 776 | } | |
| 5444 | |||
| 5445 | //finally... section data | ||
| 5446 | 800 | readsize=0; | |
| 5447 | |||
| 5448 | //shops | ||
| 5449 |
2/2✓ Branch 0 taken 24 times.
✓ Branch 1 taken 776 times.
|
800 | if(Header->zelda_version > 0x192) |
| 5450 | { | ||
| 5451 |
1/2✓ Branch 0 taken 776 times.
✗ Branch 1 not taken.
|
776 | if(!p_igetw(&shops,f)) |
| 5452 | { | ||
| 5453 | ✗ | return qe_invalid; | |
| 5454 | } | ||
| 5455 | 776 | } | |
| 5456 | |||
| 5457 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 800 times.
|
800 | if (shops > NUM_SHOPS) |
| 5458 | { | ||
| 5459 | ✗ | return qe_invalid; | |
| 5460 | } | ||
| 5461 | |||
| 5462 |
2/2✓ Branch 0 taken 11038 times.
✓ Branch 1 taken 800 times.
|
11838 | for(int32_t i=0; i<shops; i++) |
| 5463 | { | ||
| 5464 |
2/2✓ Branch 0 taken 1200 times.
✓ Branch 1 taken 9838 times.
|
11038 | if(s_version > 6) |
| 5465 | { | ||
| 5466 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 9838 times.
|
9838 | if(!p_getstr(temp_misc.shop[i].name,sizeof(temp_misc.shop[i].name)-1,f)) |
| 5467 | { | ||
| 5468 | ✗ | return qe_invalid; | |
| 5469 | } | ||
| 5470 | 9838 | } | |
| 5471 | |||
| 5472 |
2/2✓ Branch 0 taken 33114 times.
✓ Branch 1 taken 11038 times.
|
44152 | for(int32_t j=0; j<3; j++) |
| 5473 | { | ||
| 5474 |
1/2✓ Branch 0 taken 33114 times.
✗ Branch 1 not taken.
|
33114 | if(!p_getc(&temp_misc.shop[i].item[j],f)) |
| 5475 | { | ||
| 5476 | ✗ | return qe_invalid; | |
| 5477 | } | ||
| 5478 | |||
| 5479 |
2/2✓ Branch 0 taken 29514 times.
✓ Branch 1 taken 3600 times.
|
33114 | if(s_version < 4) |
| 5480 | { | ||
| 5481 | 3600 | temp_misc.shop[i].hasitem[j] = (temp_misc.shop[i].item[j] == 0) ? 0 : 1; | |
| 5482 | 3600 | } | |
| 5483 | 33114 | } | |
| 5484 | |||
| 5485 |
2/2✓ Branch 0 taken 10654 times.
✓ Branch 1 taken 384 times.
|
11038 | if(Header->zelda_version < 0x193) |
| 5486 | { | ||
| 5487 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 384 times.
|
384 | if(!p_getc(&tempbyte,f)) |
| 5488 | { | ||
| 5489 | ✗ | return qe_invalid; | |
| 5490 | } | ||
| 5491 | 384 | } | |
| 5492 | |||
| 5493 |
2/2✓ Branch 0 taken 33114 times.
✓ Branch 1 taken 11038 times.
|
44152 | for(int32_t j=0; j<3; j++) |
| 5494 | { | ||
| 5495 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 33114 times.
|
33114 | if(!p_igetw(&temp_misc.shop[i].price[j],f)) |
| 5496 | { | ||
| 5497 | ✗ | return qe_invalid; | |
| 5498 | } | ||
| 5499 | 33114 | } | |
| 5500 | |||
| 5501 |
2/2✓ Branch 0 taken 1200 times.
✓ Branch 1 taken 9838 times.
|
11038 | if(s_version > 3) |
| 5502 | { | ||
| 5503 |
2/2✓ Branch 0 taken 29514 times.
✓ Branch 1 taken 9838 times.
|
39352 | for(int32_t j=0; j<3; j++) |
| 5504 | { | ||
| 5505 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 29514 times.
|
29514 | if(!p_getc(&temp_misc.shop[i].hasitem[j],f)) |
| 5506 | ✗ | return qe_invalid; | |
| 5507 | 29514 | } | |
| 5508 | 9838 | } | |
| 5509 | |||
| 5510 | /* | ||
| 5511 | if(s_version < 8) | ||
| 5512 | { | ||
| 5513 | for(int32_t j=0; j<3; j++) | ||
| 5514 | { | ||
| 5515 | (&temp_misc.shop[i].str[j])=0; //initialise. | ||
| 5516 | } | ||
| 5517 | } | ||
| 5518 | */ | ||
| 5519 | 11038 | } | |
| 5520 | |||
| 5521 | //filter all the 0 items to the end (yeah, bubble sort; sue me) | ||
| 5522 |
2/2✓ Branch 0 taken 204800 times.
✓ Branch 1 taken 800 times.
|
205600 | for(int32_t i=0; i<maxshops; ++i) |
| 5523 | { | ||
| 5524 |
2/2✓ Branch 0 taken 409600 times.
✓ Branch 1 taken 204800 times.
|
614400 | for(int32_t j=0; j<3-1; j++) |
| 5525 | { | ||
| 5526 |
2/2✓ Branch 0 taken 614400 times.
✓ Branch 1 taken 409600 times.
|
1024000 | for(int32_t k=0; k<2-j; k++) |
| 5527 | { | ||
| 5528 |
2/2✓ Branch 0 taken 23819 times.
✓ Branch 1 taken 590581 times.
|
614400 | if(temp_misc.shop[i].hasitem[k]==0) |
| 5529 | { | ||
| 5530 | 590581 | swaptmp = temp_misc.shop[i].item[k]; | |
| 5531 | 590581 | temp_misc.shop[i].item[k] = temp_misc.shop[i].item[k+1]; | |
| 5532 | 590581 | temp_misc.shop[i].item[k+1] = swaptmp; | |
| 5533 | 590581 | swaptmp = temp_misc.shop[i].price[k]; | |
| 5534 | 590581 | temp_misc.shop[i].price[k] = temp_misc.shop[i].price[k+1]; | |
| 5535 | 590581 | temp_misc.shop[i].price[k+1] = swaptmp; | |
| 5536 | 590581 | swaptmp = temp_misc.shop[i].hasitem[k]; | |
| 5537 | 590581 | temp_misc.shop[i].hasitem[k] = temp_misc.shop[i].hasitem[k+1]; | |
| 5538 | 590581 | temp_misc.shop[i].hasitem[k+1] = swaptmp; | |
| 5539 | 590581 | } | |
| 5540 | 614400 | } | |
| 5541 | 409600 | } | |
| 5542 | 204800 | } | |
| 5543 | |||
| 5544 | //infos | ||
| 5545 |
2/2✓ Branch 0 taken 24 times.
✓ Branch 1 taken 776 times.
|
800 | if(Header->zelda_version > 0x192) |
| 5546 | { | ||
| 5547 |
1/2✓ Branch 0 taken 776 times.
✗ Branch 1 not taken.
|
776 | if(!p_igetw(&infos,f)) |
| 5548 | { | ||
| 5549 | ✗ | return qe_invalid; | |
| 5550 | } | ||
| 5551 | 776 | } | |
| 5552 | |||
| 5553 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 800 times.
|
800 | if (infos > NUM_INFOS) |
| 5554 | { | ||
| 5555 | ✗ | return qe_invalid; | |
| 5556 | } | ||
| 5557 | |||
| 5558 | |||
| 5559 |
2/2✓ Branch 0 taken 10344 times.
✓ Branch 1 taken 800 times.
|
11144 | for(int32_t i=0; i<infos; i++) |
| 5560 | { | ||
| 5561 |
2/2✓ Branch 0 taken 761 times.
✓ Branch 1 taken 9583 times.
|
10344 | if(s_version > 6) |
| 5562 | { | ||
| 5563 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 9583 times.
|
9583 | if(!p_getstr(temp_misc.info[i].name,sizeof(temp_misc.info[i].name)-1,f)) |
| 5564 | { | ||
| 5565 | ✗ | return qe_invalid; | |
| 5566 | } | ||
| 5567 | 9583 | } | |
| 5568 | |||
| 5569 |
2/2✓ Branch 0 taken 31032 times.
✓ Branch 1 taken 10344 times.
|
41376 | for(int32_t j=0; j<3; j++) |
| 5570 | { | ||
| 5571 |
3/4✓ Branch 0 taken 30168 times.
✓ Branch 1 taken 864 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 288 times.
|
31320 | if((Header->zelda_version < 0x192)|| |
| 5572 |
2/2✓ Branch 0 taken 288 times.
✓ Branch 1 taken 29880 times.
|
30168 | ((Header->zelda_version == 0x192)&&(Header->build<146))) |
| 5573 | { | ||
| 5574 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 864 times.
|
864 | if(!p_getc(&tempbyte,f)) |
| 5575 | { | ||
| 5576 | ✗ | return qe_invalid; | |
| 5577 | } | ||
| 5578 | |||
| 5579 | 864 | temp_misc.info[i].str[j]=tempbyte; | |
| 5580 | 864 | } | |
| 5581 | else | ||
| 5582 | { | ||
| 5583 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 30168 times.
|
30168 | if(!p_igetw(&temp_misc.info[i].str[j],f)) |
| 5584 | { | ||
| 5585 | ✗ | return qe_invalid; | |
| 5586 | } | ||
| 5587 | } | ||
| 5588 | 31032 | } | |
| 5589 | |||
| 5590 |
2/2✓ Branch 0 taken 9960 times.
✓ Branch 1 taken 384 times.
|
10344 | if(Header->zelda_version < 0x193) |
| 5591 | { | ||
| 5592 |
1/2✓ Branch 0 taken 384 times.
✗ Branch 1 not taken.
|
384 | if(!p_getc(&tempbyte,f)) |
| 5593 | { | ||
| 5594 | ✗ | return qe_invalid; | |
| 5595 | } | ||
| 5596 | 384 | } | |
| 5597 | |||
| 5598 |
3/4✓ Branch 0 taken 96 times.
✓ Branch 1 taken 10248 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 96 times.
|
10344 | if((Header->zelda_version == 0x192)&&(Header->build>145)) |
| 5599 | { | ||
| 5600 |
1/2✓ Branch 0 taken 96 times.
✗ Branch 1 not taken.
|
96 | if(!p_getc(&padding,f)) |
| 5601 | { | ||
| 5602 | ✗ | return qe_invalid; | |
| 5603 | } | ||
| 5604 | 96 | } | |
| 5605 | |||
| 5606 |
2/2✓ Branch 0 taken 31032 times.
✓ Branch 1 taken 10344 times.
|
41376 | for(int32_t j=0; j<3; j++) |
| 5607 | { | ||
| 5608 |
1/2✓ Branch 0 taken 31032 times.
✗ Branch 1 not taken.
|
31032 | if(!p_igetw(&temp_misc.info[i].price[j],f)) |
| 5609 | { | ||
| 5610 | ✗ | return qe_invalid; | |
| 5611 | } | ||
| 5612 | 31032 | } | |
| 5613 | 10344 | } | |
| 5614 | |||
| 5615 | //filter all the 0 strings to the end (yeah, bubble sort; sue me) | ||
| 5616 |
2/2✓ Branch 0 taken 204800 times.
✓ Branch 1 taken 800 times.
|
205600 | for(int32_t i=0; i<maxinfos; ++i) |
| 5617 | { | ||
| 5618 |
2/2✓ Branch 0 taken 409600 times.
✓ Branch 1 taken 204800 times.
|
614400 | for(int32_t j=0; j<3-1; j++) |
| 5619 | { | ||
| 5620 |
2/2✓ Branch 0 taken 614400 times.
✓ Branch 1 taken 409600 times.
|
1024000 | for(int32_t k=0; k<2-j; k++) |
| 5621 | { | ||
| 5622 |
2/2✓ Branch 0 taken 11716 times.
✓ Branch 1 taken 602684 times.
|
614400 | if(temp_misc.info[i].str[k]==0) |
| 5623 | { | ||
| 5624 | 602684 | swaptmp = temp_misc.info[i].str[k]; | |
| 5625 | 602684 | temp_misc.info[i].str[k] = temp_misc.info[i].str[k+1]; | |
| 5626 | 602684 | temp_misc.info[i].str[k+1] = swaptmp; | |
| 5627 | 602684 | swaptmp = temp_misc.info[i].price[k]; | |
| 5628 | 602684 | temp_misc.info[i].price[k] = temp_misc.info[i].price[k+1]; | |
| 5629 | 602684 | temp_misc.info[i].price[k+1] = swaptmp; | |
| 5630 | 602684 | } | |
| 5631 | 614400 | } | |
| 5632 | 409600 | } | |
| 5633 | 204800 | } | |
| 5634 | |||
| 5635 | |||
| 5636 | //warp rings | ||
| 5637 |
2/2✓ Branch 0 taken 83 times.
✓ Branch 1 taken 717 times.
|
800 | if(s_version > 5) |
| 5638 | 717 | warprings++; | |
| 5639 | |||
| 5640 |
2/2✓ Branch 0 taken 24 times.
✓ Branch 1 taken 776 times.
|
800 | if(Header->zelda_version > 0x192) |
| 5641 | { | ||
| 5642 |
1/2✓ Branch 0 taken 776 times.
✗ Branch 1 not taken.
|
776 | if(!p_igetw(&warprings,f)) |
| 5643 | { | ||
| 5644 | ✗ | return qe_invalid; | |
| 5645 | } | ||
| 5646 | |||
| 5647 |
2/2✓ Branch 0 taken 338 times.
✓ Branch 1 taken 438 times.
|
776 | if (warprings > NUM_WARP_RINGS) |
| 5648 | { | ||
| 5649 | // return qe_invalid; | ||
| 5650 | // Note: we can't actually fail here because for some reason, some quest files have more than the max | ||
| 5651 | // number of possible warp rings. Some examples of this are: demosp253.qst, yuurand.qst | ||
| 5652 | // So instead below we disable `keepdata` when reading the bad warp ring data, so no memory is corrupted. | ||
| 5653 | 438 | } | |
| 5654 | 776 | } | |
| 5655 | |||
| 5656 |
2/2✓ Branch 0 taken 8364 times.
✓ Branch 1 taken 800 times.
|
9164 | for(int32_t i=0; i<warprings; i++) |
| 5657 | { | ||
| 5658 | // See above comment on the `warprings` range check. | ||
| 5659 | 8364 | bool keepdata = i < NUM_WARP_RINGS; | |
| 5660 | |||
| 5661 |
2/2✓ Branch 0 taken 74156 times.
✓ Branch 1 taken 8364 times.
|
82520 | for(int32_t j=0; j<8+((s_version > 5)?1:0); j++) |
| 5662 | { | ||
| 5663 |
2/2✓ Branch 0 taken 8960 times.
✓ Branch 1 taken 65196 times.
|
74156 | if(s_version <= 3) |
| 5664 | { | ||
| 5665 |
1/2✓ Branch 0 taken 8960 times.
✗ Branch 1 not taken.
|
8960 | if(!p_getc(&tempbyte,f)) |
| 5666 | { | ||
| 5667 | ✗ | return qe_invalid; | |
| 5668 | } | ||
| 5669 | |||
| 5670 |
2/2✓ Branch 0 taken 3192 times.
✓ Branch 1 taken 5768 times.
|
8960 | if (keepdata) |
| 5671 | 5768 | temp_misc.warp[i].dmap[j]=(word)tempbyte; | |
| 5672 | 8960 | } | |
| 5673 | else | ||
| 5674 | { | ||
| 5675 | word tempword; | ||
| 5676 |
1/2✓ Branch 0 taken 65196 times.
✗ Branch 1 not taken.
|
65196 | if(!p_igetw(&tempword,f)) |
| 5677 | { | ||
| 5678 | ✗ | return qe_invalid; | |
| 5679 | } | ||
| 5680 | |||
| 5681 |
2/2✓ Branch 0 taken 7425 times.
✓ Branch 1 taken 57771 times.
|
65196 | if (keepdata) |
| 5682 | 57771 | temp_misc.warp[i].dmap[j] = tempword; | |
| 5683 | } | ||
| 5684 | 74156 | } | |
| 5685 | |||
| 5686 |
2/2✓ Branch 0 taken 74156 times.
✓ Branch 1 taken 8364 times.
|
82520 | for(int32_t j=0; j<8+((s_version > 5)?1:0); j++) |
| 5687 | { | ||
| 5688 |
1/2✓ Branch 0 taken 74156 times.
✗ Branch 1 not taken.
|
74156 | if(!p_getc(&tempbyte,f)) |
| 5689 | { | ||
| 5690 | ✗ | return qe_invalid; | |
| 5691 | } | ||
| 5692 |
2/2✓ Branch 0 taken 10617 times.
✓ Branch 1 taken 63539 times.
|
74156 | if (keepdata) |
| 5693 | 63539 | temp_misc.warp[i].scr[j] = tempbyte; | |
| 5694 | 74156 | } | |
| 5695 | |||
| 5696 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 8364 times.
|
8364 | if(!p_getc(&tempbyte,f)) |
| 5697 | { | ||
| 5698 | ✗ | return qe_invalid; | |
| 5699 | } | ||
| 5700 |
2/2✓ Branch 0 taken 1224 times.
✓ Branch 1 taken 7140 times.
|
8364 | if (keepdata) |
| 5701 | 7140 | temp_misc.warp[i].size = tempbyte; | |
| 5702 | |||
| 5703 |
2/2✓ Branch 0 taken 8172 times.
✓ Branch 1 taken 192 times.
|
8364 | if(Header->zelda_version < 0x193) |
| 5704 | { | ||
| 5705 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 192 times.
|
192 | if(!p_getc(&tempbyte,f)) |
| 5706 | { | ||
| 5707 | ✗ | return qe_invalid; | |
| 5708 | } | ||
| 5709 | 192 | } | |
| 5710 | 8364 | } | |
| 5711 | |||
| 5712 | //palette cycles | ||
| 5713 |
2/2✓ Branch 0 taken 776 times.
✓ Branch 1 taken 24 times.
|
800 | if(Header->zelda_version < 0x193) //in 1.93+, palette cycling is saved with the palettes |
| 5714 | { | ||
| 5715 |
2/2✓ Branch 0 taken 6144 times.
✓ Branch 1 taken 24 times.
|
6168 | for(int32_t i=0; i<256; i++) |
| 5716 | { | ||
| 5717 |
2/2✓ Branch 0 taken 18432 times.
✓ Branch 1 taken 6144 times.
|
24576 | for(int32_t j=0; j<3; j++) |
| 5718 | { | ||
| 5719 | 18432 | temp_misc.cycles[i][j].first=0; | |
| 5720 | 18432 | temp_misc.cycles[i][j].count=0; | |
| 5721 | 18432 | temp_misc.cycles[i][j].speed=0; | |
| 5722 | 18432 | } | |
| 5723 | 6144 | } | |
| 5724 | |||
| 5725 |
3/4✓ Branch 0 taken 6 times.
✓ Branch 1 taken 18 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 6 times.
|
30 | if((Header->zelda_version < 0x192)|| |
| 5726 |
1/2✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
|
6 | ((Header->zelda_version == 0x192)&&(Header->build<73))) |
| 5727 | { | ||
| 5728 | 18 | palcycles=16; | |
| 5729 | 18 | } | |
| 5730 | |||
| 5731 |
2/2✓ Branch 0 taken 1824 times.
✓ Branch 1 taken 24 times.
|
1848 | for(int32_t i=0; i<palcycles; i++) |
| 5732 | { | ||
| 5733 |
2/2✓ Branch 0 taken 5472 times.
✓ Branch 1 taken 1824 times.
|
7296 | for(int32_t j=0; j<3; j++) |
| 5734 | { | ||
| 5735 |
1/2✓ Branch 0 taken 5472 times.
✗ Branch 1 not taken.
|
5472 | if(!p_getc(&temp_misc.cycles[i][j].first,f)) |
| 5736 | { | ||
| 5737 | ✗ | return qe_invalid; | |
| 5738 | } | ||
| 5739 | |||
| 5740 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 5472 times.
|
5472 | if(!p_getc(&temp_misc.cycles[i][j].count,f)) |
| 5741 | { | ||
| 5742 | ✗ | return qe_invalid; | |
| 5743 | } | ||
| 5744 | |||
| 5745 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 5472 times.
|
5472 | if(!p_getc(&temp_misc.cycles[i][j].speed,f)) |
| 5746 | { | ||
| 5747 | ✗ | return qe_invalid; | |
| 5748 | } | ||
| 5749 | 5472 | } | |
| 5750 | 1824 | } | |
| 5751 | 24 | } | |
| 5752 | |||
| 5753 | //Wind warps are now just another warp ring. | ||
| 5754 |
2/2✓ Branch 0 taken 717 times.
✓ Branch 1 taken 83 times.
|
800 | if(s_version <= 5) |
| 5755 | { | ||
| 5756 |
2/2✓ Branch 0 taken 24 times.
✓ Branch 1 taken 59 times.
|
83 | if(Header->zelda_version > 0x192) |
| 5757 | { | ||
| 5758 |
1/2✓ Branch 0 taken 59 times.
✗ Branch 1 not taken.
|
59 | if(!p_igetw(&windwarps,f)) |
| 5759 | { | ||
| 5760 | ✗ | return qe_invalid; | |
| 5761 | } | ||
| 5762 | 59 | } | |
| 5763 | |||
| 5764 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 83 times.
|
83 | if (windwarps > NUM_WARP_RINGS) |
| 5765 | { | ||
| 5766 | ✗ | return qe_invalid; | |
| 5767 | } | ||
| 5768 | |||
| 5769 |
2/2✓ Branch 0 taken 665 times.
✓ Branch 1 taken 83 times.
|
748 | for(int32_t i=0; i<windwarps; i++) |
| 5770 | { | ||
| 5771 |
1/2✓ Branch 0 taken 665 times.
✗ Branch 1 not taken.
|
665 | if(s_version <= 3) |
| 5772 | { | ||
| 5773 |
1/2✓ Branch 0 taken 665 times.
✗ Branch 1 not taken.
|
665 | if(!p_getc(&tempbyte,f)) |
| 5774 | { | ||
| 5775 | ✗ | return qe_invalid; | |
| 5776 | } | ||
| 5777 | |||
| 5778 | 665 | temp_misc.warp[8].dmap[i]=tempbyte; | |
| 5779 | 665 | } | |
| 5780 | else | ||
| 5781 | { | ||
| 5782 | ✗ | if(!p_igetw(&temp_misc.warp[8].dmap[i],f)) | |
| 5783 | { | ||
| 5784 | ✗ | return qe_invalid; | |
| 5785 | } | ||
| 5786 | } | ||
| 5787 | |||
| 5788 |
1/2✓ Branch 0 taken 665 times.
✗ Branch 1 not taken.
|
665 | if(!p_getc(&temp_misc.warp[8].scr[i],f)) |
| 5789 | { | ||
| 5790 | ✗ | return qe_invalid; | |
| 5791 | } | ||
| 5792 | |||
| 5793 | 665 | temp_misc.warp[8].size = 9; | |
| 5794 | |||
| 5795 |
1/2✓ Branch 0 taken 665 times.
✗ Branch 1 not taken.
|
665 | if(s_version == 5) |
| 5796 | { | ||
| 5797 | ✗ | if(!p_getc(&tempbyte,f)) | |
| 5798 | { | ||
| 5799 | ✗ | return qe_invalid; | |
| 5800 | } | ||
| 5801 | ✗ | } | |
| 5802 | 665 | } | |
| 5803 | 83 | } | |
| 5804 | |||
| 5805 | |||
| 5806 | //triforce pieces | ||
| 5807 |
2/2✓ Branch 0 taken 6400 times.
✓ Branch 1 taken 800 times.
|
7200 | for(int32_t i=0; i<triforces; i++) |
| 5808 | { | ||
| 5809 |
1/2✓ Branch 0 taken 6400 times.
✗ Branch 1 not taken.
|
6400 | if(!p_getc(&temp_misc.triforce[i],f)) |
| 5810 | { | ||
| 5811 | ✗ | return qe_invalid; | |
| 5812 | } | ||
| 5813 | 6400 | } | |
| 5814 | |||
| 5815 | //misc color data | ||
| 5816 |
2/2✓ Branch 0 taken 717 times.
✓ Branch 1 taken 83 times.
|
800 | if(s_version<3) |
| 5817 | { | ||
| 5818 |
1/2✓ Branch 0 taken 83 times.
✗ Branch 1 not taken.
|
83 | if(!p_getc(&temp_misc.colors.text,f)) |
| 5819 | { | ||
| 5820 | ✗ | return qe_invalid; | |
| 5821 | } | ||
| 5822 | |||
| 5823 |
1/2✓ Branch 0 taken 83 times.
✗ Branch 1 not taken.
|
83 | if(!p_getc(&temp_misc.colors.caption,f)) |
| 5824 | { | ||
| 5825 | ✗ | return qe_invalid; | |
| 5826 | } | ||
| 5827 | |||
| 5828 |
1/2✓ Branch 0 taken 83 times.
✗ Branch 1 not taken.
|
83 | if(!p_getc(&temp_misc.colors.overw_bg,f)) |
| 5829 | { | ||
| 5830 | ✗ | return qe_invalid; | |
| 5831 | } | ||
| 5832 | |||
| 5833 |
1/2✓ Branch 0 taken 83 times.
✗ Branch 1 not taken.
|
83 | if(!p_getc(&temp_misc.colors.dngn_bg,f)) |
| 5834 | { | ||
| 5835 | ✗ | return qe_invalid; | |
| 5836 | } | ||
| 5837 | |||
| 5838 |
1/2✓ Branch 0 taken 83 times.
✗ Branch 1 not taken.
|
83 | if(!p_getc(&temp_misc.colors.dngn_fg,f)) |
| 5839 | { | ||
| 5840 | ✗ | return qe_invalid; | |
| 5841 | } | ||
| 5842 | |||
| 5843 |
1/2✓ Branch 0 taken 83 times.
✗ Branch 1 not taken.
|
83 | if(!p_getc(&temp_misc.colors.cave_fg,f)) |
| 5844 | { | ||
| 5845 | ✗ | return qe_invalid; | |
| 5846 | } | ||
| 5847 | |||
| 5848 |
1/2✓ Branch 0 taken 83 times.
✗ Branch 1 not taken.
|
83 | if(!p_getc(&temp_misc.colors.bs_dk,f)) |
| 5849 | { | ||
| 5850 | ✗ | return qe_invalid; | |
| 5851 | } | ||
| 5852 | |||
| 5853 |
1/2✓ Branch 0 taken 83 times.
✗ Branch 1 not taken.
|
83 | if(!p_getc(&temp_misc.colors.bs_goal,f)) |
| 5854 | { | ||
| 5855 | ✗ | return qe_invalid; | |
| 5856 | } | ||
| 5857 | |||
| 5858 |
1/2✓ Branch 0 taken 83 times.
✗ Branch 1 not taken.
|
83 | if(!p_getc(&temp_misc.colors.compass_lt,f)) |
| 5859 | { | ||
| 5860 | ✗ | return qe_invalid; | |
| 5861 | } | ||
| 5862 | |||
| 5863 |
1/2✓ Branch 0 taken 83 times.
✗ Branch 1 not taken.
|
83 | if(!p_getc(&temp_misc.colors.compass_dk,f)) |
| 5864 | { | ||
| 5865 | ✗ | return qe_invalid; | |
| 5866 | } | ||
| 5867 | |||
| 5868 |
1/2✓ Branch 0 taken 83 times.
✗ Branch 1 not taken.
|
83 | if(!p_getc(&temp_misc.colors.subscr_bg,f)) |
| 5869 | { | ||
| 5870 | ✗ | return qe_invalid; | |
| 5871 | } | ||
| 5872 | |||
| 5873 |
1/2✓ Branch 0 taken 83 times.
✗ Branch 1 not taken.
|
83 | if(!p_getc(&temp_misc.colors.triframe_color,f)) |
| 5874 | { | ||
| 5875 | ✗ | return qe_invalid; | |
| 5876 | } | ||
| 5877 | |||
| 5878 |
1/2✓ Branch 0 taken 83 times.
✗ Branch 1 not taken.
|
83 | if(!p_getc(&temp_misc.colors.hero_dot,f)) |
| 5879 | { | ||
| 5880 | ✗ | return qe_invalid; | |
| 5881 | } | ||
| 5882 | |||
| 5883 |
1/2✓ Branch 0 taken 83 times.
✗ Branch 1 not taken.
|
83 | if(!p_getc(&temp_misc.colors.bmap_bg,f)) |
| 5884 | { | ||
| 5885 | ✗ | return qe_invalid; | |
| 5886 | } | ||
| 5887 | |||
| 5888 |
1/2✓ Branch 0 taken 83 times.
✗ Branch 1 not taken.
|
83 | if(!p_getc(&temp_misc.colors.bmap_fg,f)) |
| 5889 | { | ||
| 5890 | ✗ | return qe_invalid; | |
| 5891 | } | ||
| 5892 | |||
| 5893 |
1/2✓ Branch 0 taken 83 times.
✗ Branch 1 not taken.
|
83 | if(!p_getc(&temp_misc.colors.triforce_cset,f)) |
| 5894 | { | ||
| 5895 | ✗ | return qe_invalid; | |
| 5896 | } | ||
| 5897 | |||
| 5898 |
1/2✓ Branch 0 taken 83 times.
✗ Branch 1 not taken.
|
83 | if(!p_getc(&temp_misc.colors.triframe_cset,f)) |
| 5899 | { | ||
| 5900 | ✗ | return qe_invalid; | |
| 5901 | } | ||
| 5902 | |||
| 5903 |
1/2✓ Branch 0 taken 83 times.
✗ Branch 1 not taken.
|
83 | if(!p_getc(&temp_misc.colors.overworld_map_cset,f)) |
| 5904 | { | ||
| 5905 | ✗ | return qe_invalid; | |
| 5906 | } | ||
| 5907 | |||
| 5908 |
1/2✓ Branch 0 taken 83 times.
✗ Branch 1 not taken.
|
83 | if(!p_getc(&temp_misc.colors.dungeon_map_cset,f)) |
| 5909 | { | ||
| 5910 | ✗ | return qe_invalid; | |
| 5911 | } | ||
| 5912 | |||
| 5913 |
1/2✓ Branch 0 taken 83 times.
✗ Branch 1 not taken.
|
83 | if(!p_getc(&temp_misc.colors.blueframe_cset,f)) |
| 5914 | { | ||
| 5915 | ✗ | return qe_invalid; | |
| 5916 | } | ||
| 5917 | |||
| 5918 |
1/2✓ Branch 0 taken 83 times.
✗ Branch 1 not taken.
|
83 | if(!p_igetw(&temp_misc.colors.triforce_tile,f)) |
| 5919 | { | ||
| 5920 | ✗ | return qe_invalid; | |
| 5921 | } | ||
| 5922 | |||
| 5923 |
1/2✓ Branch 0 taken 83 times.
✗ Branch 1 not taken.
|
83 | if(!p_igetw(&temp_misc.colors.triframe_tile,f)) |
| 5924 | { | ||
| 5925 | ✗ | return qe_invalid; | |
| 5926 | } | ||
| 5927 | |||
| 5928 |
1/2✓ Branch 0 taken 83 times.
✗ Branch 1 not taken.
|
83 | if(!p_igetw(&temp_misc.colors.overworld_map_tile,f)) |
| 5929 | { | ||
| 5930 | ✗ | return qe_invalid; | |
| 5931 | } | ||
| 5932 | |||
| 5933 |
1/2✓ Branch 0 taken 83 times.
✗ Branch 1 not taken.
|
83 | if(!p_igetw(&temp_misc.colors.dungeon_map_tile,f)) |
| 5934 | { | ||
| 5935 | ✗ | return qe_invalid; | |
| 5936 | } | ||
| 5937 | |||
| 5938 |
1/2✓ Branch 0 taken 83 times.
✗ Branch 1 not taken.
|
83 | if(!p_igetw(&temp_misc.colors.blueframe_tile,f)) |
| 5939 | { | ||
| 5940 | ✗ | return qe_invalid; | |
| 5941 | } | ||
| 5942 | |||
| 5943 |
1/2✓ Branch 0 taken 83 times.
✗ Branch 1 not taken.
|
83 | if(!p_igetw(&temp_misc.colors.HCpieces_tile,f)) |
| 5944 | { | ||
| 5945 | ✗ | return qe_invalid; | |
| 5946 | } | ||
| 5947 | |||
| 5948 |
1/2✓ Branch 0 taken 83 times.
✗ Branch 1 not taken.
|
83 | if(!p_getc(&temp_misc.colors.HCpieces_cset,f)) |
| 5949 | { | ||
| 5950 | ✗ | return qe_invalid; | |
| 5951 | } | ||
| 5952 | |||
| 5953 | 83 | temp_misc.colors.msgtext = 0x01; | |
| 5954 | |||
| 5955 |
2/2✓ Branch 0 taken 59 times.
✓ Branch 1 taken 24 times.
|
83 | if(Header->zelda_version < 0x193) |
| 5956 | { | ||
| 5957 |
2/2✓ Branch 0 taken 168 times.
✓ Branch 1 taken 24 times.
|
192 | for(int32_t i=0; i<7; i++) |
| 5958 | { | ||
| 5959 |
1/2✓ Branch 0 taken 168 times.
✗ Branch 1 not taken.
|
168 | if(!p_getc(&tempbyte,f)) |
| 5960 | { | ||
| 5961 | ✗ | return qe_invalid; | |
| 5962 | } | ||
| 5963 | 168 | } | |
| 5964 | 24 | } | |
| 5965 | |||
| 5966 |
3/4✓ Branch 0 taken 6 times.
✓ Branch 1 taken 77 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 6 times.
|
83 | if((Header->zelda_version == 0x192)&&(Header->build>145)) |
| 5967 | { | ||
| 5968 |
2/2✓ Branch 0 taken 1536 times.
✓ Branch 1 taken 6 times.
|
1542 | for(int32_t i=0; i<256; i++) |
| 5969 | { | ||
| 5970 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1536 times.
|
1536 | if(!p_getc(&tempbyte,f)) |
| 5971 | { | ||
| 5972 | ✗ | return qe_invalid; | |
| 5973 | } | ||
| 5974 | 1536 | } | |
| 5975 | 6 | } | |
| 5976 | |||
| 5977 |
1/2✓ Branch 0 taken 83 times.
✗ Branch 1 not taken.
|
83 | if(s_version>1) |
| 5978 | { | ||
| 5979 | ✗ | if(!p_getc(&temp_misc.colors.subscr_shadow,f)) | |
| 5980 | { | ||
| 5981 | ✗ | return qe_invalid; | |
| 5982 | } | ||
| 5983 | ✗ | } | |
| 5984 | |||
| 5985 | //save game icons | ||
| 5986 |
3/4✓ Branch 0 taken 65 times.
✓ Branch 1 taken 18 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 6 times.
|
89 | if((Header->zelda_version < 0x192)|| |
| 5987 |
2/2✓ Branch 0 taken 6 times.
✓ Branch 1 taken 59 times.
|
65 | ((Header->zelda_version == 0x192)&&(Header->build<73))) |
| 5988 | { | ||
| 5989 | 18 | icons=3; | |
| 5990 | 18 | } | |
| 5991 | |||
| 5992 |
2/2✓ Branch 0 taken 314 times.
✓ Branch 1 taken 83 times.
|
397 | for(int32_t i=0; i<icons; i++) |
| 5993 | { | ||
| 5994 |
1/2✓ Branch 0 taken 314 times.
✗ Branch 1 not taken.
|
314 | if(!p_igetw(&temp_misc.icons[i],f)) |
| 5995 | { | ||
| 5996 | ✗ | return qe_invalid; | |
| 5997 | } | ||
| 5998 | 314 | } | |
| 5999 | 83 | } | |
| 6000 | |||
| 6001 |
3/4✓ Branch 0 taken 782 times.
✓ Branch 1 taken 18 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 6 times.
|
806 | if((Header->zelda_version < 0x192)|| |
| 6002 |
2/2✓ Branch 0 taken 6 times.
✓ Branch 1 taken 776 times.
|
782 | ((Header->zelda_version == 0x192)&&(Header->build<30))) |
| 6003 | { | ||
| 6004 | 18 | memcpy(Misc, &temp_misc, sizeof(temp_misc)); | |
| 6005 | |||
| 6006 | 18 | return 0; | |
| 6007 | } | ||
| 6008 | |||
| 6009 | //pond information | ||
| 6010 |
2/2✓ Branch 0 taken 776 times.
✓ Branch 1 taken 6 times.
|
782 | if(Header->zelda_version < 0x193) |
| 6011 | { | ||
| 6012 |
2/4✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 6 times.
✗ Branch 3 not taken.
|
6 | if((Header->zelda_version == 0x192)&&(Header->build<146)) |
| 6013 | { | ||
| 6014 | ✗ | pondsize=25; | |
| 6015 | ✗ | } | |
| 6016 | |||
| 6017 |
2/2✓ Branch 0 taken 96 times.
✓ Branch 1 taken 6 times.
|
102 | for(int32_t i=0; i<ponds; i++) |
| 6018 | { | ||
| 6019 |
2/2✓ Branch 0 taken 6912 times.
✓ Branch 1 taken 96 times.
|
7008 | for(int32_t j=0; j<pondsize; j++) |
| 6020 | { | ||
| 6021 |
1/2✓ Branch 0 taken 6912 times.
✗ Branch 1 not taken.
|
6912 | if(!p_getc(&tempbyte,f)) |
| 6022 | { | ||
| 6023 | ✗ | return qe_invalid; | |
| 6024 | |||
| 6025 | } | ||
| 6026 | 6912 | } | |
| 6027 | 96 | } | |
| 6028 | 6 | } | |
| 6029 | |||
| 6030 | //end string | ||
| 6031 |
2/4✓ Branch 0 taken 782 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 6 times.
|
788 | if((Header->zelda_version < 0x192)|| |
| 6032 |
2/2✓ Branch 0 taken 6 times.
✓ Branch 1 taken 776 times.
|
782 | ((Header->zelda_version == 0x192)&&(Header->build<146))) |
| 6033 | { | ||
| 6034 | ✗ | if(!p_getc(&tempbyte,f)) | |
| 6035 | { | ||
| 6036 | ✗ | return qe_invalid; | |
| 6037 | } | ||
| 6038 | |||
| 6039 | ✗ | temp_misc.endstring=tempbyte; | |
| 6040 | |||
| 6041 | ✗ | if(!p_getc(&tempbyte,f)) | |
| 6042 | { | ||
| 6043 | ✗ | return qe_invalid; | |
| 6044 | } | ||
| 6045 | ✗ | } | |
| 6046 | else | ||
| 6047 | { | ||
| 6048 |
1/2✓ Branch 0 taken 782 times.
✗ Branch 1 not taken.
|
782 | if(!p_igetw(&temp_misc.endstring,f)) |
| 6049 | { | ||
| 6050 | ✗ | return qe_invalid; | |
| 6051 | } | ||
| 6052 | } | ||
| 6053 | |||
| 6054 | //expansion | ||
| 6055 |
2/2✓ Branch 0 taken 776 times.
✓ Branch 1 taken 6 times.
|
782 | if(Header->zelda_version < 0x193) |
| 6056 | { | ||
| 6057 |
2/4✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 6 times.
✗ Branch 3 not taken.
|
6 | if((Header->zelda_version == 0x192)&&(Header->build<73)) |
| 6058 | { | ||
| 6059 | ✗ | expansionsize=99*2; | |
| 6060 | ✗ | } | |
| 6061 | |||
| 6062 |
2/2✓ Branch 0 taken 1176 times.
✓ Branch 1 taken 6 times.
|
1182 | for(int32_t i=0; i<expansionsize; i++) |
| 6063 | { | ||
| 6064 |
1/2✓ Branch 0 taken 1176 times.
✗ Branch 1 not taken.
|
1176 | if(!p_getc(&tempbyte,f)) |
| 6065 | { | ||
| 6066 | ✗ | return qe_invalid; | |
| 6067 | } | ||
| 6068 | 1176 | } | |
| 6069 | 6 | } | |
| 6070 | //shops v8 | ||
| 6071 | |||
| 6072 | |||
| 6073 |
2/2✓ Branch 0 taken 586 times.
✓ Branch 1 taken 196 times.
|
782 | if(s_version >= 8) |
| 6074 | { | ||
| 6075 |
2/2✓ Branch 0 taken 2384 times.
✓ Branch 1 taken 196 times.
|
2580 | for(int32_t i=0; i<shops; i++) |
| 6076 | { | ||
| 6077 |
2/2✓ Branch 0 taken 7152 times.
✓ Branch 1 taken 2384 times.
|
9536 | for(int32_t j=0; j<3; j++) |
| 6078 | { | ||
| 6079 |
1/2✓ Branch 0 taken 7152 times.
✗ Branch 1 not taken.
|
7152 | if(!p_igetw(&temp_misc.shop[i].str[j],f)) |
| 6080 | ✗ | return qe_invalid; | |
| 6081 | 7152 | } | |
| 6082 | 2384 | } | |
| 6083 | 196 | } | |
| 6084 | |||
| 6085 | 782 | memset(&temp_misc.questmisc, 0, sizeof(int32_t)*32); | |
| 6086 | 782 | memset(&temp_misc.zscript_last_compiled_version, 0, sizeof(int32_t)); | |
| 6087 | |||
| 6088 | //v9 includes quest misc[32] | ||
| 6089 | // ... this has been deprecated (2024) | ||
| 6090 |
2/2✓ Branch 0 taken 586 times.
✓ Branch 1 taken 196 times.
|
782 | if(s_version >= 9) |
| 6091 | { | ||
| 6092 |
2/2✓ Branch 0 taken 6272 times.
✓ Branch 1 taken 196 times.
|
6468 | for ( int32_t q = 0; q < 32; q++ ) |
| 6093 | { | ||
| 6094 |
1/2✓ Branch 0 taken 6272 times.
✗ Branch 1 not taken.
|
6272 | if(!p_igetl(&temp_misc.questmisc[q],f)) |
| 6095 | ✗ | return qe_invalid; | |
| 6096 | 6272 | } | |
| 6097 | // this was string labels | ||
| 6098 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 196 times.
|
196 | if (pack_fseek(f, 32 * 128)) |
| 6099 | ✗ | return qe_invalid; | |
| 6100 | 196 | } | |
| 6101 | |||
| 6102 |
2/2✓ Branch 0 taken 196 times.
✓ Branch 1 taken 586 times.
|
782 | if(s_version >= 11 ) |
| 6103 | { | ||
| 6104 |
1/2✓ Branch 0 taken 196 times.
✗ Branch 1 not taken.
|
196 | if(!p_igetl(&temp_misc.zscript_last_compiled_version,f)) |
| 6105 | ✗ | return qe_invalid; | |
| 6106 | 196 | } | |
| 6107 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 586 times.
|
586 | else if(s_version < 11 ) |
| 6108 | { | ||
| 6109 | 586 | temp_misc.zscript_last_compiled_version = -1; | |
| 6110 | 586 | } | |
| 6111 | |||
| 6112 | 782 | FFCore.quest_format[vLastCompile] = temp_misc.zscript_last_compiled_version; | |
| 6113 | |||
| 6114 |
2/2✓ Branch 0 taken 196 times.
✓ Branch 1 taken 586 times.
|
782 | if(s_version >= 12) |
| 6115 | { | ||
| 6116 | byte spr; | ||
| 6117 |
2/2✓ Branch 0 taken 50176 times.
✓ Branch 1 taken 196 times.
|
50372 | for(int32_t q = 0; q < sprMAX; ++q) |
| 6118 | { | ||
| 6119 |
1/2✓ Branch 0 taken 50176 times.
✗ Branch 1 not taken.
|
50176 | if(!p_getc(&spr,f)) |
| 6120 | ✗ | return qe_invalid; | |
| 6121 | 50176 | temp_misc.sprites[q] = spr; | |
| 6122 | 50176 | } | |
| 6123 | 196 | } | |
| 6124 | else | ||
| 6125 | { | ||
| 6126 | 586 | memset(&(temp_misc.sprites), 0, sizeof(temp_misc.sprites)); | |
| 6127 | //temp_misc.sprites[sprFALL] = ; | ||
| 6128 | } | ||
| 6129 | |||
| 6130 |
2/2✓ Branch 0 taken 196 times.
✓ Branch 1 taken 586 times.
|
782 | if(s_version >= 13) |
| 6131 | { | ||
| 6132 |
2/2✓ Branch 0 taken 12544 times.
✓ Branch 1 taken 196 times.
|
12740 | for(size_t q = 0; q < 64; ++q) |
| 6133 | { | ||
| 6134 | 12544 | bottletype* bt = &(temp_misc.bottle_types[q]); | |
| 6135 |
1/2✓ Branch 0 taken 12544 times.
✗ Branch 1 not taken.
|
12544 | if (!p_getstr(bt->name, sizeof(bt->name)-1, f)) |
| 6136 | ✗ | return qe_invalid; | |
| 6137 |
2/2✓ Branch 0 taken 37632 times.
✓ Branch 1 taken 12544 times.
|
50176 | for(size_t j = 0; j < 3; ++j) |
| 6138 | { | ||
| 6139 |
1/2✓ Branch 0 taken 37632 times.
✗ Branch 1 not taken.
|
37632 | if (!p_getc(&(bt->counter[j]), f)) |
| 6140 | ✗ | return qe_invalid; | |
| 6141 |
1/2✓ Branch 0 taken 37632 times.
✗ Branch 1 not taken.
|
37632 | if (!p_igetw(&(bt->amount[j]), f)) |
| 6142 | ✗ | return qe_invalid; | |
| 6143 | 37632 | } | |
| 6144 |
1/2✓ Branch 0 taken 12544 times.
✗ Branch 1 not taken.
|
12544 | if (!p_getc(&(bt->flags), f)) |
| 6145 | ✗ | return qe_invalid; | |
| 6146 |
1/2✓ Branch 0 taken 12544 times.
✗ Branch 1 not taken.
|
12544 | if (!p_getc(&(bt->next_type), f)) |
| 6147 | ✗ | return qe_invalid; | |
| 6148 | 12544 | } | |
| 6149 |
2/2✓ Branch 0 taken 50176 times.
✓ Branch 1 taken 196 times.
|
50372 | for(size_t q = 0; q < 256; ++q) |
| 6150 | { | ||
| 6151 | 50176 | bottleshoptype* bst = &(temp_misc.bottle_shop_types[q]); | |
| 6152 |
1/2✓ Branch 0 taken 50176 times.
✗ Branch 1 not taken.
|
50176 | if (!pfread(bst->name, sizeof(bst->name)-1, f)) |
| 6153 | ✗ | return qe_invalid; | |
| 6154 |
2/2✓ Branch 0 taken 150528 times.
✓ Branch 1 taken 50176 times.
|
200704 | for(size_t j = 0; j < 3; ++j) |
| 6155 | { | ||
| 6156 |
1/2✓ Branch 0 taken 150528 times.
✗ Branch 1 not taken.
|
150528 | if (!p_getc(&(bst->fill[j]), f)) |
| 6157 | ✗ | return qe_invalid; | |
| 6158 |
1/2✓ Branch 0 taken 150528 times.
✗ Branch 1 not taken.
|
150528 | if (!p_igetw(&(bst->comb[j]), f)) |
| 6159 | ✗ | return qe_invalid; | |
| 6160 |
1/2✓ Branch 0 taken 150528 times.
✗ Branch 1 not taken.
|
150528 | if (!p_getc(&(bst->cset[j]), f)) |
| 6161 | ✗ | return qe_invalid; | |
| 6162 |
1/2✓ Branch 0 taken 150528 times.
✗ Branch 1 not taken.
|
150528 | if (!p_igetw(&(bst->price[j]), f)) |
| 6163 | ✗ | return qe_invalid; | |
| 6164 |
1/2✓ Branch 0 taken 150528 times.
✗ Branch 1 not taken.
|
150528 | if (!p_igetw(&(bst->str[j]), f)) |
| 6165 | ✗ | return qe_invalid; | |
| 6166 | 150528 | } | |
| 6167 | 50176 | } | |
| 6168 | 196 | } | |
| 6169 | else | ||
| 6170 | { | ||
| 6171 |
2/2✓ Branch 0 taken 37504 times.
✓ Branch 1 taken 586 times.
|
38090 | for(size_t q = 0; q < 64; ++q) |
| 6172 | 37504 | temp_misc.bottle_types[q].clear(); | |
| 6173 |
2/2✓ Branch 0 taken 150016 times.
✓ Branch 1 taken 586 times.
|
150602 | for(size_t q = 0; q < 256; ++q) |
| 6174 | 150016 | temp_misc.bottle_shop_types[q].clear(); | |
| 6175 | } | ||
| 6176 | |||
| 6177 |
2/2✓ Branch 0 taken 196 times.
✓ Branch 1 taken 586 times.
|
782 | if(s_version >= 14) |
| 6178 | { | ||
| 6179 | byte msfx; | ||
| 6180 |
2/2✓ Branch 0 taken 50176 times.
✓ Branch 1 taken 196 times.
|
50372 | for(int32_t q = 0; q < sfxMAX; ++q) |
| 6181 | { | ||
| 6182 |
1/2✓ Branch 0 taken 50176 times.
✗ Branch 1 not taken.
|
50176 | if(!p_getc(&msfx,f)) |
| 6183 | ✗ | return qe_invalid; | |
| 6184 | 50176 | temp_misc.miscsfx[q] = msfx; | |
| 6185 | 50176 | } | |
| 6186 | 196 | } | |
| 6187 | else | ||
| 6188 | { | ||
| 6189 | 586 | memset(&(temp_misc.miscsfx), 0, sizeof(temp_misc.miscsfx)); | |
| 6190 | 586 | temp_misc.miscsfx[sfxBUSHGRASS] = WAV_ZN1GRASSCUT; | |
| 6191 | 586 | temp_misc.miscsfx[sfxLOWHEART] = WAV_ER; | |
| 6192 | } | ||
| 6193 |
2/2✓ Branch 0 taken 196 times.
✓ Branch 1 taken 586 times.
|
782 | if(s_version < 15) |
| 6194 | { | ||
| 6195 | 586 | temp_misc.miscsfx[sfxHURTPLAYER] = WAV_OUCH; | |
| 6196 | 586 | temp_misc.miscsfx[sfxHAMMERPOUND] = WAV_ZN1HAMMERPOST; | |
| 6197 | 586 | temp_misc.miscsfx[sfxSUBSCR_ITEM_ASSIGN] = WAV_PLACE; | |
| 6198 | 586 | temp_misc.miscsfx[sfxSUBSCR_CURSOR_MOVE] = WAV_CHIME; | |
| 6199 | 586 | temp_misc.miscsfx[sfxREFILL] = WAV_MSG; | |
| 6200 | 586 | temp_misc.miscsfx[sfxDRAIN] = WAV_MSG; | |
| 6201 | 586 | } | |
| 6202 |
2/2✓ Branch 0 taken 180 times.
✓ Branch 1 taken 602 times.
|
782 | if(s_version < 16) |
| 6203 | { | ||
| 6204 | 602 | temp_misc.miscsfx[sfxTAP] = WAV_ZN1TAP; | |
| 6205 | 602 | temp_misc.miscsfx[sfxTAP_HOLLOW] = WAV_ZN1TAP2; | |
| 6206 | 602 | } | |
| 6207 | |||
| 6208 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 781 times.
|
782 | if (!should_skip) |
| 6209 | 781 | memcpy(Misc, &temp_misc, sizeof(temp_misc)); | |
| 6210 | |||
| 6211 | 782 | return 0; | |
| 6212 | 800 | } | |
| 6213 | |||
| 6214 | extern char *item_string[MAXITEMS]; | ||
| 6215 | extern const char *old_item_string[iLast]; | ||
| 6216 | extern char *weapon_string[MAXWPNS]; | ||
| 6217 | extern const char *old_weapon_string[wLast]; | ||
| 6218 | |||
| 6219 | 479 | int32_t readitems(PACKFILE *f, word version, word build) | |
| 6220 | { | ||
| 6221 |
2/2✓ Branch 0 taken 455 times.
✓ Branch 1 taken 24 times.
|
479 | bool should_skip = legacy_skip_flags && get_bit(legacy_skip_flags, skip_items); |
| 6222 | |||
| 6223 | byte padding; | ||
| 6224 | int32_t dummy; | ||
| 6225 | 479 | word items_to_read=MAXITEMS; | |
| 6226 | 479 | itemdata tempitem; | |
| 6227 | 479 | word s_version=0; | |
| 6228 | word dummy_word; | ||
| 6229 | |||
| 6230 |
2/2✓ Branch 0 taken 473 times.
✓ Branch 1 taken 6 times.
|
479 | if(version < 0x186) |
| 6231 | { | ||
| 6232 | 6 | items_to_read=64; | |
| 6233 | 6 | } | |
| 6234 | |||
| 6235 |
2/2✓ Branch 0 taken 24 times.
✓ Branch 1 taken 455 times.
|
479 | if(version > 0x192) |
| 6236 | { | ||
| 6237 | 455 | items_to_read=0; | |
| 6238 | |||
| 6239 | //section version info | ||
| 6240 |
1/2✓ Branch 0 taken 455 times.
✗ Branch 1 not taken.
|
455 | if(!p_igetw(&s_version,f)) |
| 6241 | { | ||
| 6242 | ✗ | return qe_invalid; | |
| 6243 | } | ||
| 6244 | |||
| 6245 | 455 | FFCore.quest_format[vItems] = s_version; | |
| 6246 | |||
| 6247 |
1/2✓ Branch 0 taken 455 times.
✗ Branch 1 not taken.
|
455 | if(!read_deprecated_section_cversion(f)) |
| 6248 | { | ||
| 6249 | ✗ | return qe_invalid; | |
| 6250 | } | ||
| 6251 | |||
| 6252 | //section size | ||
| 6253 |
1/2✓ Branch 0 taken 455 times.
✗ Branch 1 not taken.
|
455 | if(!p_igetl(&dummy,f)) |
| 6254 | { | ||
| 6255 | ✗ | return qe_invalid; | |
| 6256 | } | ||
| 6257 | |||
| 6258 | //finally... section data | ||
| 6259 |
1/2✓ Branch 0 taken 455 times.
✗ Branch 1 not taken.
|
455 | if(!p_igetw(&items_to_read,f)) |
| 6260 | { | ||
| 6261 | ✗ | return qe_invalid; | |
| 6262 | } | ||
| 6263 | |||
| 6264 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 455 times.
|
455 | if (items_to_read > MAXITEMS) |
| 6265 | { | ||
| 6266 | ✗ | return qe_invalid; | |
| 6267 | } | ||
| 6268 | 455 | } | |
| 6269 | |||
| 6270 |
2/2✓ Branch 0 taken 396 times.
✓ Branch 1 taken 83 times.
|
479 | if(s_version>1) |
| 6271 | { | ||
| 6272 |
2/2✓ Branch 0 taken 101376 times.
✓ Branch 1 taken 396 times.
|
101772 | for(int32_t i=0; i<items_to_read; i++) |
| 6273 | { | ||
| 6274 | char tempname[64]; | ||
| 6275 | |||
| 6276 |
1/2✓ Branch 0 taken 101376 times.
✗ Branch 1 not taken.
|
101376 | if(!pfread(tempname, 64, f)) |
| 6277 | { | ||
| 6278 | ✗ | return qe_invalid; | |
| 6279 | } | ||
| 6280 | |||
| 6281 | 101376 | item_string[i][0] = '\0'; | |
| 6282 | 101376 | strncat(item_string[i], tempname, 64 - 1); | |
| 6283 | 101376 | } | |
| 6284 | 396 | } | |
| 6285 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 82 times.
|
83 | else if (!should_skip) |
| 6286 | { | ||
| 6287 |
2/2✓ Branch 0 taken 20992 times.
✓ Branch 1 taken 82 times.
|
21074 | for(int32_t i=0; i<MAXITEMS; i++) |
| 6288 | { | ||
| 6289 | 20992 | reset_itemname(i); | |
| 6290 | 20992 | } | |
| 6291 | 82 | } | |
| 6292 | |||
| 6293 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 478 times.
|
479 | if (!should_skip) |
| 6294 |
2/2✓ Branch 0 taken 122368 times.
✓ Branch 1 taken 478 times.
|
122846 | for(int32_t i=0; i<MAXITEMS; i++) |
| 6295 | { | ||
| 6296 | 122368 | itemdata& id = itemsbuf[i]; | |
| 6297 | 122368 | memset(&id, 0, sizeof(itemdata)); | |
| 6298 | 122368 | id.count=-1; | |
| 6299 | 122368 | id.playsound=WAV_SCALE; | |
| 6300 | 122368 | reset_itembuf(&id,i); | |
| 6301 | 122846 | } | |
| 6302 | |||
| 6303 |
2/2✓ Branch 0 taken 110498 times.
✓ Branch 1 taken 479 times.
|
110977 | for(int32_t i=0; i<items_to_read; i++) |
| 6304 | { | ||
| 6305 | 110498 | tempitem = itemdata(); | |
| 6306 | 110498 | reset_itembuf(&tempitem,i); | |
| 6307 | |||
| 6308 |
2/2✓ Branch 0 taken 50176 times.
✓ Branch 1 taken 60322 times.
|
110498 | if ( s_version > 35 ) //expanded tiles |
| 6309 | { | ||
| 6310 |
1/2✓ Branch 0 taken 50176 times.
✗ Branch 1 not taken.
|
50176 | if(!p_igetl(&tempitem.tile,f)) |
| 6311 | { | ||
| 6312 | ✗ | return qe_invalid; | |
| 6313 | } | ||
| 6314 | 50176 | } | |
| 6315 | else | ||
| 6316 | { | ||
| 6317 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 60322 times.
|
60322 | if(!p_igetw(&tempitem.tile,f)) |
| 6318 | { | ||
| 6319 | ✗ | return qe_invalid; | |
| 6320 | } | ||
| 6321 | } | ||
| 6322 | |||
| 6323 |
1/2✓ Branch 0 taken 110498 times.
✗ Branch 1 not taken.
|
110498 | if(!p_getc(&tempitem.misc_flags,f)) |
| 6324 | { | ||
| 6325 | ✗ | return qe_invalid; | |
| 6326 | } | ||
| 6327 | |||
| 6328 |
1/2✓ Branch 0 taken 110498 times.
✗ Branch 1 not taken.
|
110498 | if(!p_getc(&tempitem.csets,f)) |
| 6329 | { | ||
| 6330 | ✗ | return qe_invalid; | |
| 6331 | } | ||
| 6332 | |||
| 6333 |
1/2✓ Branch 0 taken 110498 times.
✗ Branch 1 not taken.
|
110498 | if(!p_getc(&tempitem.frames,f)) |
| 6334 | { | ||
| 6335 | ✗ | return qe_invalid; | |
| 6336 | } | ||
| 6337 | |||
| 6338 |
1/2✓ Branch 0 taken 110498 times.
✗ Branch 1 not taken.
|
110498 | if(!p_getc(&tempitem.speed,f)) |
| 6339 | { | ||
| 6340 | ✗ | return qe_invalid; | |
| 6341 | } | ||
| 6342 | |||
| 6343 |
1/2✓ Branch 0 taken 110498 times.
✗ Branch 1 not taken.
|
110498 | if(!p_getc(&tempitem.delay,f)) |
| 6344 | { | ||
| 6345 | ✗ | return qe_invalid; | |
| 6346 | } | ||
| 6347 | |||
| 6348 |
2/2✓ Branch 0 taken 105506 times.
✓ Branch 1 taken 4992 times.
|
110498 | if(version < 0x193) |
| 6349 | { | ||
| 6350 |
1/2✓ Branch 0 taken 4992 times.
✗ Branch 1 not taken.
|
4992 | if(!p_getc(&padding,f)) |
| 6351 | { | ||
| 6352 | ✗ | return qe_invalid; | |
| 6353 | } | ||
| 6354 | |||
| 6355 |
4/6✓ Branch 0 taken 1536 times.
✓ Branch 1 taken 3456 times.
✓ Branch 2 taken 1536 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1536 times.
✗ Branch 5 not taken.
|
4992 | if((version < 0x192)||((version == 0x192)&&(build<186))) |
| 6356 | { | ||
| 6357 |
2/2✓ Branch 0 taken 256 times.
✓ Branch 1 taken 4736 times.
|
4992 | if (should_skip) |
| 6358 | 256 | continue; | |
| 6359 | |||
| 6360 |
3/3✓ Branch 0 taken 4690 times.
✓ Branch 1 taken 23 times.
✓ Branch 2 taken 23 times.
|
4736 | switch(i) |
| 6361 | { | ||
| 6362 | case iShield: | ||
| 6363 | 23 | tempitem.ltm=get_qr(qr_BSZELDA)?-12:10; | |
| 6364 | 23 | break; | |
| 6365 | |||
| 6366 | case iMShield: | ||
| 6367 | 23 | tempitem.ltm=get_qr(qr_BSZELDA)?-6:-10; | |
| 6368 | 23 | break; | |
| 6369 | |||
| 6370 | default: | ||
| 6371 | 4690 | tempitem.ltm=0; | |
| 6372 | 4690 | break; | |
| 6373 | } | ||
| 6374 | |||
| 6375 | 4736 | tempitem.count=-1; | |
| 6376 | 4736 | tempitem.flags=item_none; | |
| 6377 | 4736 | tempitem.wpn=tempitem.wpn2=tempitem.wpn3=tempitem.wpn3=tempitem.pickup_hearts= | |
| 6378 | 4736 | tempitem.misc1=tempitem.misc2=tempitem.usesound=0; | |
| 6379 | 4736 | tempitem.family=0xFF; | |
| 6380 | 4736 | tempitem.playsound=WAV_SCALE; | |
| 6381 | 4736 | reset_itembuf(&tempitem,i); | |
| 6382 | |||
| 6383 | 4736 | itemsbuf[i] = tempitem; | |
| 6384 | |||
| 6385 | 4736 | continue; | |
| 6386 | } | ||
| 6387 | ✗ | } | |
| 6388 | |||
| 6389 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 105506 times.
|
105506 | if(!p_igetl(&tempitem.ltm,f)) |
| 6390 | { | ||
| 6391 | ✗ | return qe_invalid; | |
| 6392 | } | ||
| 6393 | |||
| 6394 |
1/2✓ Branch 0 taken 105506 times.
✗ Branch 1 not taken.
|
105506 | if(version < 0x193) |
| 6395 | { | ||
| 6396 | ✗ | for(int32_t q=0; q<12; q++) | |
| 6397 | { | ||
| 6398 | ✗ | if(!p_getc(&padding,f)) | |
| 6399 | { | ||
| 6400 | ✗ | return qe_invalid; | |
| 6401 | } | ||
| 6402 | ✗ | } | |
| 6403 | ✗ | } | |
| 6404 | |||
| 6405 |
2/2✓ Branch 0 taken 101376 times.
✓ Branch 1 taken 4130 times.
|
105506 | if(s_version>1) |
| 6406 | { | ||
| 6407 |
2/2✓ Branch 0 taken 50176 times.
✓ Branch 1 taken 51200 times.
|
101376 | if ( s_version >= 31 ) |
| 6408 | { | ||
| 6409 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 50176 times.
|
50176 | if(!p_igetl(&tempitem.family,f)) |
| 6410 | { | ||
| 6411 | ✗ | return qe_invalid; | |
| 6412 | } | ||
| 6413 | 50176 | } | |
| 6414 | else | ||
| 6415 | { | ||
| 6416 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 51200 times.
|
51200 | if(!p_getc(&tempitem.family,f)) |
| 6417 | { | ||
| 6418 | ✗ | return qe_invalid; | |
| 6419 | } | ||
| 6420 | } | ||
| 6421 |
1/2✓ Branch 0 taken 101376 times.
✗ Branch 1 not taken.
|
101376 | if(s_version < 16) |
| 6422 | ✗ | if(tempitem.family == 0xFF) | |
| 6423 | ✗ | tempitem.family = itype_misc; | |
| 6424 | |||
| 6425 |
1/2✓ Branch 0 taken 101376 times.
✗ Branch 1 not taken.
|
101376 | if(!p_getc(&tempitem.fam_type,f)) |
| 6426 | { | ||
| 6427 | ✗ | return qe_invalid; | |
| 6428 | } | ||
| 6429 | |||
| 6430 |
1/2✓ Branch 0 taken 101376 times.
✗ Branch 1 not taken.
|
101376 | if(s_version>5) |
| 6431 | { | ||
| 6432 |
2/2✓ Branch 0 taken 50176 times.
✓ Branch 1 taken 51200 times.
|
101376 | if(s_version>=31) |
| 6433 | { | ||
| 6434 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 50176 times.
|
50176 | if(!p_igetl(&tempitem.power,f)) |
| 6435 | { | ||
| 6436 | ✗ | return qe_invalid; | |
| 6437 | } | ||
| 6438 | 50176 | } | |
| 6439 | else | ||
| 6440 | { | ||
| 6441 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 51200 times.
|
51200 | if(!p_getc(&tempitem.power,f)) |
| 6442 | { | ||
| 6443 | ✗ | return qe_invalid; | |
| 6444 | } | ||
| 6445 | } | ||
| 6446 | |||
| 6447 | //converted flags from 16b to 32b -Z | ||
| 6448 |
2/2✓ Branch 0 taken 51200 times.
✓ Branch 1 taken 50176 times.
|
101376 | if ( s_version < 41 ) |
| 6449 | { | ||
| 6450 |
1/2✓ Branch 0 taken 51200 times.
✗ Branch 1 not taken.
|
51200 | if(!p_igetw(&tempitem.flags,f)) |
| 6451 | { | ||
| 6452 | ✗ | return qe_invalid; | |
| 6453 | } | ||
| 6454 | 51200 | } | |
| 6455 | else | ||
| 6456 | { | ||
| 6457 |
1/2✓ Branch 0 taken 50176 times.
✗ Branch 1 not taken.
|
50176 | if(!p_igetl(&tempitem.flags,f)) |
| 6458 | { | ||
| 6459 | ✗ | return qe_invalid; | |
| 6460 | } | ||
| 6461 | } | ||
| 6462 | 101376 | } | |
| 6463 | else | ||
| 6464 | { | ||
| 6465 | //tempitem.power = tempitem.fam_type; | ||
| 6466 | char tempchar; | ||
| 6467 | |||
| 6468 | ✗ | if(!p_getc(&tempchar,f)) | |
| 6469 | { | ||
| 6470 | ✗ | return qe_invalid; | |
| 6471 | } | ||
| 6472 | |||
| 6473 | ✗ | if (tempchar) tempitem.flags |= item_gamedata; | |
| 6474 | } | ||
| 6475 | |||
| 6476 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 101376 times.
|
101376 | if(!p_igetw(&tempitem.script,f)) |
| 6477 | { | ||
| 6478 | ✗ | return qe_invalid; | |
| 6479 | } | ||
| 6480 | |||
| 6481 |
1/2✓ Branch 0 taken 101376 times.
✗ Branch 1 not taken.
|
101376 | if(s_version<=3) |
| 6482 | { | ||
| 6483 | ✗ | if(tempitem.script > NUMSCRIPTITEM) | |
| 6484 | { | ||
| 6485 | ✗ | tempitem.script = 0; | |
| 6486 | ✗ | } | |
| 6487 | ✗ | } | |
| 6488 | |||
| 6489 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 101376 times.
|
101376 | if(!p_getc(&tempitem.count,f)) |
| 6490 | { | ||
| 6491 | ✗ | return qe_invalid; | |
| 6492 | } | ||
| 6493 | |||
| 6494 |
1/2✓ Branch 0 taken 101376 times.
✗ Branch 1 not taken.
|
101376 | if(!p_igetw(&tempitem.amount,f)) |
| 6495 | { | ||
| 6496 | ✗ | return qe_invalid; | |
| 6497 | } | ||
| 6498 | |||
| 6499 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 101376 times.
|
101376 | if(!p_igetw(&tempitem.collect_script,f)) |
| 6500 | { | ||
| 6501 | ✗ | return qe_invalid; | |
| 6502 | } | ||
| 6503 | |||
| 6504 |
1/2✓ Branch 0 taken 101376 times.
✗ Branch 1 not taken.
|
101376 | if(s_version<=3) |
| 6505 | { | ||
| 6506 | ✗ | if(tempitem.collect_script > NUMSCRIPTITEM) | |
| 6507 | { | ||
| 6508 | ✗ | tempitem.collect_script = 0; | |
| 6509 | ✗ | } | |
| 6510 | ✗ | } | |
| 6511 | |||
| 6512 |
1/2✓ Branch 0 taken 101376 times.
✗ Branch 1 not taken.
|
101376 | if(!p_igetw(&tempitem.setmax,f)) |
| 6513 | { | ||
| 6514 | ✗ | return qe_invalid; | |
| 6515 | } | ||
| 6516 | |||
| 6517 |
1/2✓ Branch 0 taken 101376 times.
✗ Branch 1 not taken.
|
101376 | if(!p_igetw(&tempitem.max,f)) |
| 6518 | { | ||
| 6519 | ✗ | return qe_invalid; | |
| 6520 | } | ||
| 6521 | |||
| 6522 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 101376 times.
|
101376 | if(!p_getc(&tempitem.playsound,f)) |
| 6523 | { | ||
| 6524 | ✗ | return qe_invalid; | |
| 6525 | } | ||
| 6526 | |||
| 6527 |
2/2✓ Branch 0 taken 811008 times.
✓ Branch 1 taken 101376 times.
|
912384 | for(int32_t j=0; j<8; j++) |
| 6528 | { | ||
| 6529 |
1/2✓ Branch 0 taken 811008 times.
✗ Branch 1 not taken.
|
811008 | if(!p_igetl(&tempitem.initiald[j],f)) |
| 6530 | { | ||
| 6531 | ✗ | return qe_invalid; | |
| 6532 | } | ||
| 6533 | 811008 | } | |
| 6534 | |||
| 6535 |
2/2✓ Branch 0 taken 202752 times.
✓ Branch 1 taken 101376 times.
|
304128 | for(int32_t j=0; j<2; j++) |
| 6536 | { | ||
| 6537 | byte temp; | ||
| 6538 |
1/2✓ Branch 0 taken 202752 times.
✗ Branch 1 not taken.
|
202752 | if(!p_getc(&temp,f)) |
| 6539 | { | ||
| 6540 | ✗ | return qe_invalid; | |
| 6541 | } | ||
| 6542 | 202752 | } | |
| 6543 | |||
| 6544 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 101376 times.
|
101376 | if(s_version>4) |
| 6545 | { | ||
| 6546 |
1/2✓ Branch 0 taken 101376 times.
✗ Branch 1 not taken.
|
101376 | if(s_version>5) |
| 6547 | { | ||
| 6548 |
1/2✓ Branch 0 taken 101376 times.
✗ Branch 1 not taken.
|
101376 | if(!p_getc(&tempitem.wpn,f)) |
| 6549 | { | ||
| 6550 | ✗ | return qe_invalid; | |
| 6551 | } | ||
| 6552 | |||
| 6553 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 101376 times.
|
101376 | if(!p_getc(&tempitem.wpn2,f)) |
| 6554 | { | ||
| 6555 | ✗ | return qe_invalid; | |
| 6556 | } | ||
| 6557 | |||
| 6558 |
1/2✓ Branch 0 taken 101376 times.
✗ Branch 1 not taken.
|
101376 | if(!p_getc(&tempitem.wpn3,f)) |
| 6559 | { | ||
| 6560 | ✗ | return qe_invalid; | |
| 6561 | } | ||
| 6562 | |||
| 6563 |
1/2✓ Branch 0 taken 101376 times.
✗ Branch 1 not taken.
|
101376 | if(!p_getc(&tempitem.wpn4,f)) |
| 6564 | { | ||
| 6565 | ✗ | return qe_invalid; | |
| 6566 | } | ||
| 6567 | |||
| 6568 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 101376 times.
|
101376 | if(s_version>=15) |
| 6569 | { | ||
| 6570 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 101376 times.
|
101376 | if(!p_getc(&tempitem.wpn5,f)) |
| 6571 | { | ||
| 6572 | ✗ | return qe_invalid; | |
| 6573 | } | ||
| 6574 | |||
| 6575 |
1/2✓ Branch 0 taken 101376 times.
✗ Branch 1 not taken.
|
101376 | if(!p_getc(&tempitem.wpn6,f)) |
| 6576 | { | ||
| 6577 | ✗ | return qe_invalid; | |
| 6578 | } | ||
| 6579 | |||
| 6580 |
1/2✓ Branch 0 taken 101376 times.
✗ Branch 1 not taken.
|
101376 | if(!p_getc(&tempitem.wpn7,f)) |
| 6581 | { | ||
| 6582 | ✗ | return qe_invalid; | |
| 6583 | } | ||
| 6584 | |||
| 6585 |
1/2✓ Branch 0 taken 101376 times.
✗ Branch 1 not taken.
|
101376 | if(!p_getc(&tempitem.wpn8,f)) |
| 6586 | { | ||
| 6587 | ✗ | return qe_invalid; | |
| 6588 | } | ||
| 6589 | |||
| 6590 |
1/2✓ Branch 0 taken 101376 times.
✗ Branch 1 not taken.
|
101376 | if(!p_getc(&tempitem.wpn9,f)) |
| 6591 | { | ||
| 6592 | ✗ | return qe_invalid; | |
| 6593 | } | ||
| 6594 | |||
| 6595 |
1/2✓ Branch 0 taken 101376 times.
✗ Branch 1 not taken.
|
101376 | if(!p_getc(&tempitem.wpn10,f)) |
| 6596 | { | ||
| 6597 | ✗ | return qe_invalid; | |
| 6598 | } | ||
| 6599 | 101376 | } | |
| 6600 | |||
| 6601 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 101376 times.
|
101376 | if(!p_getc(&tempitem.pickup_hearts,f)) |
| 6602 | { | ||
| 6603 | ✗ | return qe_invalid; | |
| 6604 | } | ||
| 6605 | |||
| 6606 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 101376 times.
|
101376 | if(s_version<15) |
| 6607 | { | ||
| 6608 | ✗ | if(!p_igetw(&dummy_word,f)) | |
| 6609 | { | ||
| 6610 | ✗ | return qe_invalid; | |
| 6611 | } | ||
| 6612 | |||
| 6613 | ✗ | tempitem.misc1=dummy_word; | |
| 6614 | |||
| 6615 | ✗ | if(!p_igetw(&dummy_word,f)) | |
| 6616 | { | ||
| 6617 | ✗ | return qe_invalid; | |
| 6618 | } | ||
| 6619 | |||
| 6620 | ✗ | tempitem.misc2=dummy_word; | |
| 6621 | ✗ | } | |
| 6622 | else | ||
| 6623 | { | ||
| 6624 |
1/2✓ Branch 0 taken 101376 times.
✗ Branch 1 not taken.
|
101376 | if(!p_igetl(&tempitem.misc1,f)) |
| 6625 | { | ||
| 6626 | ✗ | return qe_invalid; | |
| 6627 | } | ||
| 6628 | |||
| 6629 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 101376 times.
|
101376 | if(!p_igetl(&tempitem.misc2,f)) |
| 6630 | { | ||
| 6631 | ✗ | return qe_invalid; | |
| 6632 | } | ||
| 6633 | |||
| 6634 | // Version 24: sh_ice -> sh_script; previously, all shields could block script weapons | ||
| 6635 |
1/2✓ Branch 0 taken 101376 times.
✗ Branch 1 not taken.
|
101376 | if(s_version<24) |
| 6636 | { | ||
| 6637 | ✗ | if(tempitem.family==itype_shield) | |
| 6638 | { | ||
| 6639 | ✗ | tempitem.misc1|=sh_script; | |
| 6640 | ✗ | } | |
| 6641 | ✗ | } | |
| 6642 | } | ||
| 6643 | |||
| 6644 |
2/2✓ Branch 0 taken 51200 times.
✓ Branch 1 taken 50176 times.
|
101376 | if(s_version < 53) |
| 6645 | { | ||
| 6646 | byte tempbyte; | ||
| 6647 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 51200 times.
|
51200 | if(!p_getc(&tempbyte,f)) |
| 6648 | { | ||
| 6649 | ✗ | return qe_invalid; | |
| 6650 | } | ||
| 6651 | 51200 | tempitem.cost_amount[0] = tempbyte; | |
| 6652 | 51200 | } | |
| 6653 | else | ||
| 6654 | { | ||
| 6655 |
2/2✓ Branch 0 taken 100352 times.
✓ Branch 1 taken 50176 times.
|
150528 | for(auto q = 0; q < 2; ++q) |
| 6656 | { | ||
| 6657 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 100352 times.
|
100352 | if(!p_igetw(&tempitem.cost_amount[q],f)) |
| 6658 | { | ||
| 6659 | ✗ | return qe_invalid; | |
| 6660 | } | ||
| 6661 | 100352 | } | |
| 6662 | } | ||
| 6663 | 101376 | } | |
| 6664 | else | ||
| 6665 | { | ||
| 6666 | char tempchar; | ||
| 6667 | |||
| 6668 | ✗ | if(!p_getc(&tempchar,f)) | |
| 6669 | { | ||
| 6670 | ✗ | return qe_invalid; | |
| 6671 | } | ||
| 6672 | |||
| 6673 | ✗ | if (tempchar) tempitem.flags |= item_edible; | |
| 6674 | } | ||
| 6675 | |||
| 6676 | // June 2007: more misc. attributes | ||
| 6677 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 101376 times.
|
101376 | if(s_version>=12) |
| 6678 | { | ||
| 6679 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 101376 times.
|
101376 | if(s_version<15) |
| 6680 | { | ||
| 6681 | ✗ | if(!p_igetw(&dummy_word,f)) | |
| 6682 | { | ||
| 6683 | ✗ | return qe_invalid; | |
| 6684 | } | ||
| 6685 | |||
| 6686 | ✗ | tempitem.misc3=dummy_word; | |
| 6687 | |||
| 6688 | ✗ | if(!p_igetw(&dummy_word,f)) | |
| 6689 | { | ||
| 6690 | ✗ | return qe_invalid; | |
| 6691 | } | ||
| 6692 | |||
| 6693 | ✗ | tempitem.misc4=dummy_word; | |
| 6694 | ✗ | } | |
| 6695 | else | ||
| 6696 | { | ||
| 6697 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 101376 times.
|
101376 | if(!p_igetl(&tempitem.misc3,f)) |
| 6698 | { | ||
| 6699 | ✗ | return qe_invalid; | |
| 6700 | } | ||
| 6701 | |||
| 6702 |
1/2✓ Branch 0 taken 101376 times.
✗ Branch 1 not taken.
|
101376 | if(!p_igetl(&tempitem.misc4,f)) |
| 6703 | { | ||
| 6704 | ✗ | return qe_invalid; | |
| 6705 | } | ||
| 6706 | |||
| 6707 |
1/2✓ Branch 0 taken 101376 times.
✗ Branch 1 not taken.
|
101376 | if(!p_igetl(&tempitem.misc5,f)) |
| 6708 | { | ||
| 6709 | ✗ | return qe_invalid; | |
| 6710 | } | ||
| 6711 | |||
| 6712 |
1/2✓ Branch 0 taken 101376 times.
✗ Branch 1 not taken.
|
101376 | if(!p_igetl(&tempitem.misc6,f)) |
| 6713 | { | ||
| 6714 | ✗ | return qe_invalid; | |
| 6715 | } | ||
| 6716 | |||
| 6717 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 101376 times.
|
101376 | if(!p_igetl(&tempitem.misc7,f)) |
| 6718 | { | ||
| 6719 | ✗ | return qe_invalid; | |
| 6720 | } | ||
| 6721 | |||
| 6722 |
1/2✓ Branch 0 taken 101376 times.
✗ Branch 1 not taken.
|
101376 | if(!p_igetl(&tempitem.misc8,f)) |
| 6723 | { | ||
| 6724 | ✗ | return qe_invalid; | |
| 6725 | } | ||
| 6726 | |||
| 6727 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 101376 times.
|
101376 | if(!p_igetl(&tempitem.misc9,f)) |
| 6728 | { | ||
| 6729 | ✗ | return qe_invalid; | |
| 6730 | } | ||
| 6731 | |||
| 6732 |
1/2✓ Branch 0 taken 101376 times.
✗ Branch 1 not taken.
|
101376 | if(!p_igetl(&tempitem.misc10,f)) |
| 6733 | { | ||
| 6734 | ✗ | return qe_invalid; | |
| 6735 | } | ||
| 6736 | } | ||
| 6737 | |||
| 6738 |
1/2✓ Branch 0 taken 101376 times.
✗ Branch 1 not taken.
|
101376 | if(!p_getc(&tempitem.usesound,f)) |
| 6739 | { | ||
| 6740 | ✗ | return qe_invalid; | |
| 6741 | } | ||
| 6742 | |||
| 6743 |
2/2✓ Branch 0 taken 50176 times.
✓ Branch 1 taken 51200 times.
|
101376 | if(s_version >= 49) |
| 6744 | { | ||
| 6745 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 50176 times.
|
50176 | if(!p_getc(&tempitem.usesound2,f)) |
| 6746 | { | ||
| 6747 | ✗ | return qe_invalid; | |
| 6748 | } | ||
| 6749 | 50176 | } | |
| 6750 | 51200 | else tempitem.usesound2 = 0; | |
| 6751 | |||
| 6752 |
3/4✓ Branch 0 taken 51200 times.
✓ Branch 1 taken 50176 times.
✓ Branch 2 taken 51200 times.
✗ Branch 3 not taken.
|
101376 | if(s_version < 50 && tempitem.family == itype_mirror) |
| 6753 | { | ||
| 6754 | //Split continue/dmap warp effect/sfx, port for old | ||
| 6755 | ✗ | tempitem.misc2 = tempitem.misc1; | |
| 6756 | ✗ | tempitem.usesound2 = tempitem.usesound; | |
| 6757 | ✗ | } | |
| 6758 | 101376 | } | |
| 6759 | 101376 | } | |
| 6760 | |||
| 6761 |
2/2✓ Branch 0 taken 51200 times.
✓ Branch 1 taken 50176 times.
|
101376 | if ( s_version >= 26 ) //! New itemdata vars for weapon editor. -Z |
| 6762 | { // temp.useweapon, temp.usedefence, temp.weaprange, temp.weap_pattern[ITEM_MOVEMENT_PATTERNS] | ||
| 6763 |
2/2✓ Branch 0 taken 32512 times.
✓ Branch 1 taken 17664 times.
|
50176 | if(s_version < 63) |
| 6764 | { | ||
| 6765 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 17664 times.
|
17664 | if(!p_getc(&tempitem.weap_data.imitate_weapon,f)) |
| 6766 | { | ||
| 6767 | ✗ | return qe_invalid; | |
| 6768 | } | ||
| 6769 |
1/2✓ Branch 0 taken 17664 times.
✗ Branch 1 not taken.
|
17664 | if(!p_getc(&tempitem.weap_data.default_defense,f)) |
| 6770 | { | ||
| 6771 | ✗ | return qe_invalid; | |
| 6772 | } | ||
| 6773 | 17664 | } | |
| 6774 |
1/2✓ Branch 0 taken 50176 times.
✗ Branch 1 not taken.
|
50176 | if(!p_igetl(&tempitem.weaprange,f)) |
| 6775 | { | ||
| 6776 | ✗ | return qe_invalid; | |
| 6777 | } | ||
| 6778 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 50176 times.
|
50176 | if(!p_igetl(&tempitem.weapduration,f)) |
| 6779 | { | ||
| 6780 | ✗ | return qe_invalid; | |
| 6781 | } | ||
| 6782 |
2/2✓ Branch 0 taken 501760 times.
✓ Branch 1 taken 50176 times.
|
551936 | for ( int32_t q = 0; q < ITEM_MOVEMENT_PATTERNS; q++ ) |
| 6783 | { | ||
| 6784 |
1/2✓ Branch 0 taken 501760 times.
✗ Branch 1 not taken.
|
501760 | if(!p_igetl(&tempitem.weap_pattern[q],f)) |
| 6785 | { | ||
| 6786 | ✗ | return qe_invalid; | |
| 6787 | } | ||
| 6788 | 501760 | } | |
| 6789 | 50176 | } | |
| 6790 | |||
| 6791 |
2/2✓ Branch 0 taken 51200 times.
✓ Branch 1 taken 50176 times.
|
101376 | if ( s_version >= 27 ) //! New itemdata vars for weapon editor. -Z |
| 6792 | { // temp.useweapon, temp.usedefence, temp.weaprange, temp.weap_pattern[ITEM_MOVEMENT_PATTERNS] | ||
| 6793 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 50176 times.
|
50176 | if(!p_igetl(&tempitem.duplicates,f)) |
| 6794 | { | ||
| 6795 | ✗ | return qe_invalid; | |
| 6796 | } | ||
| 6797 |
2/2✓ Branch 0 taken 32512 times.
✓ Branch 1 taken 17664 times.
|
50176 | if(s_version < 63) |
| 6798 |
2/2✓ Branch 0 taken 141312 times.
✓ Branch 1 taken 17664 times.
|
158976 | for ( int32_t q = 0; q < INITIAL_D; q++ ) |
| 6799 |
1/2✓ Branch 0 taken 141312 times.
✗ Branch 1 not taken.
|
141312 | if(!p_igetl(&tempitem.weap_data.initd[q],f)) |
| 6800 | 17664 | return qe_invalid; | |
| 6801 |
2/2✓ Branch 0 taken 100352 times.
✓ Branch 1 taken 50176 times.
|
150528 | for ( int32_t q = 0; q < 2; q++ ) |
| 6802 | { | ||
| 6803 | byte temp; | ||
| 6804 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 100352 times.
|
100352 | if(!p_getc(&temp,f)) |
| 6805 | { | ||
| 6806 | ✗ | return qe_invalid; | |
| 6807 | } | ||
| 6808 | 100352 | } | |
| 6809 | |||
| 6810 |
1/2✓ Branch 0 taken 50176 times.
✗ Branch 1 not taken.
|
50176 | if(!p_getc(&tempitem.drawlayer,f)) |
| 6811 | { | ||
| 6812 | ✗ | return qe_invalid; | |
| 6813 | } | ||
| 6814 | |||
| 6815 | |||
| 6816 |
1/2✓ Branch 0 taken 50176 times.
✗ Branch 1 not taken.
|
50176 | if(!p_igetl(&tempitem.hxofs,f)) |
| 6817 | { | ||
| 6818 | ✗ | return qe_invalid; | |
| 6819 | } | ||
| 6820 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 50176 times.
|
50176 | if(!p_igetl(&tempitem.hyofs,f)) |
| 6821 | { | ||
| 6822 | ✗ | return qe_invalid; | |
| 6823 | } | ||
| 6824 |
1/2✓ Branch 0 taken 50176 times.
✗ Branch 1 not taken.
|
50176 | if(!p_igetl(&tempitem.hxsz,f)) |
| 6825 | { | ||
| 6826 | ✗ | return qe_invalid; | |
| 6827 | } | ||
| 6828 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 50176 times.
|
50176 | if(!p_igetl(&tempitem.hysz,f)) |
| 6829 | { | ||
| 6830 | ✗ | return qe_invalid; | |
| 6831 | } | ||
| 6832 |
1/2✓ Branch 0 taken 50176 times.
✗ Branch 1 not taken.
|
50176 | if(!p_igetl(&tempitem.hzsz,f)) |
| 6833 | { | ||
| 6834 | ✗ | return qe_invalid; | |
| 6835 | } | ||
| 6836 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 50176 times.
|
50176 | if(!p_igetl(&tempitem.xofs,f)) |
| 6837 | { | ||
| 6838 | ✗ | return qe_invalid; | |
| 6839 | } | ||
| 6840 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 50176 times.
|
50176 | if(!p_igetl(&tempitem.yofs,f)) |
| 6841 | { | ||
| 6842 | ✗ | return qe_invalid; | |
| 6843 | } | ||
| 6844 |
2/2✓ Branch 0 taken 32512 times.
✓ Branch 1 taken 17664 times.
|
50176 | if(s_version < 63) |
| 6845 | { | ||
| 6846 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 17664 times.
|
17664 | if(!p_igetl(&tempitem.weap_data.hxofs,f)) |
| 6847 | ✗ | return qe_invalid; | |
| 6848 |
1/2✓ Branch 0 taken 17664 times.
✗ Branch 1 not taken.
|
17664 | if(!p_igetl(&tempitem.weap_data.hyofs,f)) |
| 6849 | ✗ | return qe_invalid; | |
| 6850 |
1/2✓ Branch 0 taken 17664 times.
✗ Branch 1 not taken.
|
17664 | if(!p_igetl(&tempitem.weap_data.hxsz,f)) |
| 6851 | ✗ | return qe_invalid; | |
| 6852 |
1/2✓ Branch 0 taken 17664 times.
✗ Branch 1 not taken.
|
17664 | if(!p_igetl(&tempitem.weap_data.hysz,f)) |
| 6853 | ✗ | return qe_invalid; | |
| 6854 |
1/2✓ Branch 0 taken 17664 times.
✗ Branch 1 not taken.
|
17664 | if(!p_igetl(&tempitem.weap_data.hzsz,f)) |
| 6855 | ✗ | return qe_invalid; | |
| 6856 |
1/2✓ Branch 0 taken 17664 times.
✗ Branch 1 not taken.
|
17664 | if(!p_igetl(&tempitem.weap_data.xofs,f)) |
| 6857 | ✗ | return qe_invalid; | |
| 6858 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 17664 times.
|
17664 | if(!p_igetl(&tempitem.weap_data.yofs,f)) |
| 6859 | ✗ | return qe_invalid; | |
| 6860 | 17664 | } | |
| 6861 |
2/2✓ Branch 0 taken 32512 times.
✓ Branch 1 taken 17664 times.
|
50176 | if(s_version < 63) |
| 6862 |
1/2✓ Branch 0 taken 17664 times.
✗ Branch 1 not taken.
|
17664 | if(!p_igetw(&tempitem.weap_data.script,f)) |
| 6863 | ✗ | return qe_invalid; | |
| 6864 |
1/2✓ Branch 0 taken 50176 times.
✗ Branch 1 not taken.
|
50176 | if(!p_igetl(&tempitem.wpnsprite,f)) |
| 6865 | { | ||
| 6866 | ✗ | return qe_invalid; | |
| 6867 | } | ||
| 6868 | 50176 | auto num_cost_tmr = (s_version > 52 ? 2 : 1); | |
| 6869 |
2/2✓ Branch 0 taken 100352 times.
✓ Branch 1 taken 50176 times.
|
150528 | for(auto q = 0; q < num_cost_tmr; ++q) |
| 6870 | { | ||
| 6871 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 100352 times.
|
100352 | if(!p_igetl(&tempitem.magiccosttimer[q],f)) |
| 6872 | { | ||
| 6873 | ✗ | return qe_invalid; | |
| 6874 | } | ||
| 6875 | 100352 | } | |
| 6876 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 50176 times.
|
50176 | for(auto q = num_cost_tmr; q < 2; ++q) |
| 6877 | ✗ | tempitem.magiccosttimer[q] = 0; | |
| 6878 | 50176 | } | |
| 6879 |
2/2✓ Branch 0 taken 51200 times.
✓ Branch 1 taken 50176 times.
|
101376 | if ( s_version >= 28 ) //! New itemdata vars for weapon editor. -Z |
| 6880 | { | ||
| 6881 | //Item Size FLags, TileWidth, TileHeight | ||
| 6882 |
1/2✓ Branch 0 taken 50176 times.
✗ Branch 1 not taken.
|
50176 | if(!p_igetl(&tempitem.overrideFLAGS,f)) |
| 6883 | { | ||
| 6884 | ✗ | return qe_invalid; | |
| 6885 | } | ||
| 6886 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 50176 times.
|
50176 | if(!p_igetl(&tempitem.tilew,f)) |
| 6887 | { | ||
| 6888 | ✗ | return qe_invalid; | |
| 6889 | } | ||
| 6890 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 50176 times.
|
50176 | if(!p_igetl(&tempitem.tileh,f)) |
| 6891 | { | ||
| 6892 | ✗ | return qe_invalid; | |
| 6893 | } | ||
| 6894 | 50176 | } | |
| 6895 |
4/4✓ Branch 0 taken 50176 times.
✓ Branch 1 taken 51200 times.
✓ Branch 2 taken 32512 times.
✓ Branch 3 taken 17664 times.
|
101376 | if ( s_version >= 29 && s_version < 63) //! More new vars. |
| 6896 | { | ||
| 6897 |
1/2✓ Branch 0 taken 17664 times.
✗ Branch 1 not taken.
|
17664 | if(!p_igetl(&tempitem.weap_data.override_flags,f)) |
| 6898 | ✗ | return qe_invalid; | |
| 6899 |
1/2✓ Branch 0 taken 17664 times.
✗ Branch 1 not taken.
|
17664 | if(!p_igetl(&tempitem.weap_data.tilew,f)) |
| 6900 | ✗ | return qe_invalid; | |
| 6901 |
1/2✓ Branch 0 taken 17664 times.
✗ Branch 1 not taken.
|
17664 | if(!p_igetl(&tempitem.weap_data.tileh,f)) |
| 6902 | ✗ | return qe_invalid; | |
| 6903 | 17664 | } | |
| 6904 |
2/2✓ Branch 0 taken 51200 times.
✓ Branch 1 taken 50176 times.
|
101376 | if ( s_version >= 30 ) //! More new vars. |
| 6905 | { | ||
| 6906 | //Pickup Type | ||
| 6907 |
1/2✓ Branch 0 taken 50176 times.
✗ Branch 1 not taken.
|
50176 | if(!p_igetl(&tempitem.pickup,f)) |
| 6908 | { | ||
| 6909 | ✗ | return qe_invalid; | |
| 6910 | } | ||
| 6911 | 50176 | } | |
| 6912 |
2/2✓ Branch 0 taken 51200 times.
✓ Branch 1 taken 50176 times.
|
101376 | if ( s_version >= 32 ) //! More new vars. |
| 6913 | { | ||
| 6914 | //Pickup Type | ||
| 6915 |
1/2✓ Branch 0 taken 50176 times.
✗ Branch 1 not taken.
|
50176 | if(!p_igetw(&tempitem.pstring,f)) |
| 6916 | { | ||
| 6917 | ✗ | return qe_invalid; | |
| 6918 | } | ||
| 6919 | 50176 | } | |
| 6920 |
2/2✓ Branch 0 taken 51200 times.
✓ Branch 1 taken 50176 times.
|
101376 | if ( s_version >= 33 ) //! More new vars. |
| 6921 | { | ||
| 6922 | //Pickup Type | ||
| 6923 |
1/2✓ Branch 0 taken 50176 times.
✗ Branch 1 not taken.
|
50176 | if(!p_igetw(&tempitem.pickup_string_flags,f)) |
| 6924 | { | ||
| 6925 | ✗ | return qe_invalid; | |
| 6926 | } | ||
| 6927 | 50176 | } | |
| 6928 |
2/2✓ Branch 0 taken 51200 times.
✓ Branch 1 taken 50176 times.
|
101376 | if ( s_version >= 34 ) //! cost counter |
| 6929 | { | ||
| 6930 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 50176 times.
|
50176 | if(s_version < 53) |
| 6931 | { | ||
| 6932 | ✗ | if(!p_getc(&tempitem.cost_counter[0],f)) | |
| 6933 | { | ||
| 6934 | ✗ | return qe_invalid; | |
| 6935 | } | ||
| 6936 | ✗ | } | |
| 6937 | else | ||
| 6938 | { | ||
| 6939 |
2/2✓ Branch 0 taken 100352 times.
✓ Branch 1 taken 50176 times.
|
150528 | for(auto q = 0; q < 2; ++q) |
| 6940 | { | ||
| 6941 |
1/2✓ Branch 0 taken 100352 times.
✗ Branch 1 not taken.
|
100352 | if(!p_getc(&tempitem.cost_counter[q],f)) |
| 6942 | { | ||
| 6943 | ✗ | return qe_invalid; | |
| 6944 | } | ||
| 6945 | 100352 | } | |
| 6946 | } | ||
| 6947 | 50176 | } | |
| 6948 |
2/2✓ Branch 0 taken 51200 times.
✓ Branch 1 taken 50176 times.
|
101376 | if ( s_version >= 44 ) //! sprite scripts |
| 6949 | { | ||
| 6950 |
2/2✓ Branch 0 taken 401408 times.
✓ Branch 1 taken 50176 times.
|
451584 | for ( int32_t q = 0; q < 8; q++ ) |
| 6951 | { | ||
| 6952 |
2/2✓ Branch 0 taken 26091520 times.
✓ Branch 1 taken 401408 times.
|
26492928 | for ( int32_t w = 0; w < 65; w++ ) |
| 6953 | { | ||
| 6954 |
1/2✓ Branch 0 taken 26091520 times.
✗ Branch 1 not taken.
|
26091520 | if(!p_getc(&(tempitem.initD_label[q][w]),f)) |
| 6955 | { | ||
| 6956 | ✗ | return qe_invalid; | |
| 6957 | } | ||
| 6958 | 26091520 | } | |
| 6959 |
2/2✓ Branch 0 taken 260096 times.
✓ Branch 1 taken 141312 times.
|
401408 | if(s_version < 63) |
| 6960 |
2/2✓ Branch 0 taken 9185280 times.
✓ Branch 1 taken 141312 times.
|
9326592 | for ( int32_t w = 0; w < 65; w++ ) |
| 6961 |
1/2✓ Branch 0 taken 9185280 times.
✗ Branch 1 not taken.
|
9185280 | if(!p_getc(&padding,f)) |
| 6962 | 141312 | return qe_invalid; | |
| 6963 |
2/2✓ Branch 0 taken 26091520 times.
✓ Branch 1 taken 401408 times.
|
26492928 | for ( int32_t w = 0; w < 65; w++ ) |
| 6964 | { | ||
| 6965 |
1/2✓ Branch 0 taken 26091520 times.
✗ Branch 1 not taken.
|
26091520 | if(!p_getc(&(tempitem.sprite_initD_label[q][w]),f)) |
| 6966 | { | ||
| 6967 | ✗ | return qe_invalid; | |
| 6968 | } | ||
| 6969 | 26091520 | } | |
| 6970 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 401408 times.
|
401408 | if(!p_igetl(&(tempitem.sprite_initiald[q]),f)) |
| 6971 | { | ||
| 6972 | ✗ | return qe_invalid; | |
| 6973 | } | ||
| 6974 | |||
| 6975 | 401408 | } | |
| 6976 |
2/2✓ Branch 0 taken 100352 times.
✓ Branch 1 taken 50176 times.
|
150528 | for ( int32_t q = 0; q < 2; q++ ) |
| 6977 | { | ||
| 6978 | byte temp; | ||
| 6979 |
1/2✓ Branch 0 taken 100352 times.
✗ Branch 1 not taken.
|
100352 | if(!p_getc(&temp,f)) |
| 6980 | { | ||
| 6981 | ✗ | return qe_invalid; | |
| 6982 | } | ||
| 6983 | 100352 | } | |
| 6984 | //Pickup Type | ||
| 6985 |
1/2✓ Branch 0 taken 50176 times.
✗ Branch 1 not taken.
|
50176 | if(!p_igetw(&tempitem.sprite_script,f)) |
| 6986 | { | ||
| 6987 | ✗ | return qe_invalid; | |
| 6988 | } | ||
| 6989 | 50176 | } | |
| 6990 |
2/2✓ Branch 0 taken 51200 times.
✓ Branch 1 taken 50176 times.
|
101376 | if ( s_version >= 48 ) //! pickup flags |
| 6991 | { | ||
| 6992 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 50176 times.
|
50176 | if(!p_getc(&(tempitem.pickupflag),f)) |
| 6993 | { | ||
| 6994 | ✗ | return qe_invalid; | |
| 6995 | } | ||
| 6996 | 50176 | } | |
| 6997 |
2/2✓ Branch 0 taken 54272 times.
✓ Branch 1 taken 47104 times.
|
101376 | if ( s_version >= 57 ) |
| 6998 | { | ||
| 6999 | 47104 | std::string str; | |
| 7000 |
2/4✓ Branch 0 taken 47104 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 47104 times.
✗ Branch 3 not taken.
|
47104 | if(!p_getcstr(&str,f)) |
| 7001 | ✗ | return qe_invalid; | |
| 7002 | 47104 | strncpy(tempitem.display_name,str.c_str(),255); | |
| 7003 |
1/3✗ Branch 0 not taken.
✗ Branch 1 not taken.
✓ Branch 2 taken 47104 times.
|
47104 | } |
| 7004 | 101376 | } | |
| 7005 | else | ||
| 7006 | { | ||
| 7007 | 4130 | tempitem.count=-1; | |
| 7008 | 4130 | tempitem.family=itype_misc; | |
| 7009 | 4130 | tempitem.flags=item_none; | |
| 7010 | 4130 | tempitem.wpn=tempitem.wpn2=tempitem.wpn3=tempitem.wpn3=tempitem.pickup_hearts=tempitem.misc1=tempitem.misc2=tempitem.usesound=0; | |
| 7011 | 4130 | tempitem.playsound=WAV_SCALE; | |
| 7012 | 4130 | reset_itembuf(&tempitem,i); | |
| 7013 | } | ||
| 7014 | |||
| 7015 |
4/4✓ Branch 0 taken 46080 times.
✓ Branch 1 taken 59426 times.
✓ Branch 2 taken 32512 times.
✓ Branch 3 taken 13568 times.
|
105506 | if(s_version >= 58 && s_version < 63) |
| 7016 | { | ||
| 7017 |
2/2✓ Branch 0 taken 67840 times.
✓ Branch 1 taken 13568 times.
|
81408 | for(int q = 0; q < WPNSPR_MAX; ++q) |
| 7018 | { | ||
| 7019 |
1/2✓ Branch 0 taken 67840 times.
✗ Branch 1 not taken.
|
67840 | if(!p_getc(&tempitem.weap_data.burnsprs[q],f)) |
| 7020 | ✗ | return qe_invalid; | |
| 7021 |
2/2✓ Branch 0 taken 1280 times.
✓ Branch 1 taken 66560 times.
|
67840 | if(s_version >= 59) |
| 7022 |
1/2✓ Branch 0 taken 66560 times.
✗ Branch 1 not taken.
|
66560 | if(!p_getc(&tempitem.weap_data.light_rads[q],f)) |
| 7023 | ✗ | return qe_invalid; | |
| 7024 | 67840 | } | |
| 7025 | 13568 | } | |
| 7026 | |||
| 7027 |
2/2✓ Branch 0 taken 71202 times.
✓ Branch 1 taken 34304 times.
|
105506 | if ( s_version >= 60 ) |
| 7028 | { | ||
| 7029 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 34304 times.
|
34304 | if(!p_getc(&tempitem.pickup_litems,f)) |
| 7030 | ✗ | return qe_invalid; | |
| 7031 |
1/2✓ Branch 0 taken 34304 times.
✗ Branch 1 not taken.
|
34304 | if(!p_igetw(&tempitem.pickup_litem_level,f)) |
| 7032 | ✗ | return qe_invalid; | |
| 7033 | 34304 | } | |
| 7034 | |||
| 7035 |
2/2✓ Branch 0 taken 34048 times.
✓ Branch 1 taken 71458 times.
|
105506 | if ( s_version >= 62 ) |
| 7036 | { | ||
| 7037 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 34048 times.
|
34048 | if (!p_igetl(&tempitem.moveflags, f)) |
| 7038 | ✗ | return qe_invalid; | |
| 7039 |
2/2✓ Branch 0 taken 32512 times.
✓ Branch 1 taken 1536 times.
|
34048 | if(s_version < 63) |
| 7040 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1536 times.
|
1536 | if (!p_igetl(&tempitem.weap_data.moveflags, f)) |
| 7041 | ✗ | return qe_invalid; | |
| 7042 | 34048 | } | |
| 7043 | else | ||
| 7044 | { | ||
| 7045 | 71458 | tempitem.moveflags = (move_obeys_grav | move_can_pitfall); | |
| 7046 |
3/3✓ Branch 0 taken 2053 times.
✓ Branch 1 taken 69086 times.
✓ Branch 2 taken 319 times.
|
71458 | switch(tempitem.family) |
| 7047 | { | ||
| 7048 | case itype_divinefire: | ||
| 7049 |
2/2✓ Branch 0 taken 185 times.
✓ Branch 1 taken 134 times.
|
319 | if(!(tempitem.flags & item_flag3)) |
| 7050 | 134 | break; | |
| 7051 | [[fallthrough]]; | ||
| 7052 | case itype_bomb: case itype_sbomb: | ||
| 7053 | case itype_bait: case itype_liftglove: | ||
| 7054 | case itype_candle: case itype_book: | ||
| 7055 | 2238 | tempitem.weap_data.moveflags = (move_obeys_grav | move_can_pitfall); | |
| 7056 | 2238 | break; | |
| 7057 | default: | ||
| 7058 | 69086 | tempitem.weap_data.moveflags = move_none; | |
| 7059 | 69086 | break; | |
| 7060 | } | ||
| 7061 | } | ||
| 7062 | |||
| 7063 |
2/2✓ Branch 0 taken 32512 times.
✓ Branch 1 taken 72994 times.
|
105506 | if(s_version >= 63) |
| 7064 | { | ||
| 7065 |
1/2✓ Branch 0 taken 32512 times.
✗ Branch 1 not taken.
|
32512 | if(auto ret = read_weap_data(tempitem.weap_data, f)) |
| 7066 | ✗ | return ret; | |
| 7067 | 32512 | } | |
| 7068 | else | ||
| 7069 | { | ||
| 7070 |
2/2✓ Branch 0 taken 17 times.
✓ Branch 1 taken 72977 times.
|
72994 | SETFLAG(tempitem.weap_data.wflags, WFLAG_UPDATE_IGNITE_SPRITE, tempitem.flags & item_burning_sprites); |
| 7071 |
3/3✓ Branch 0 taken 666 times.
✓ Branch 1 taken 72244 times.
✓ Branch 2 taken 84 times.
|
72994 | switch(tempitem.family) |
| 7072 | { | ||
| 7073 | case itype_liftglove: | ||
| 7074 | 84 | tempitem.weap_data.wflags = WFLAG_BREAK_WHEN_LANDING; | |
| 7075 | 84 | break; | |
| 7076 | case itype_bomb: case itype_sbomb: | ||
| 7077 | // Moving these over and removing them from itemdata | ||
| 7078 |
2/2✓ Branch 0 taken 643 times.
✓ Branch 1 taken 23 times.
|
666 | if(tempitem.flags & item_flag3) |
| 7079 | 23 | tempitem.weap_data.wflags |= WFLAG_STOP_WHEN_LANDING; | |
| 7080 |
2/2✓ Branch 0 taken 643 times.
✓ Branch 1 taken 23 times.
|
666 | if(tempitem.flags & item_flag5) |
| 7081 | 23 | tempitem.weap_data.wflags |= WFLAG_STOP_WHEN_HIT_SOLID; | |
| 7082 | 666 | tempitem.flags &= ~(item_flag3|item_flag5); | |
| 7083 |
2/2✓ Branch 0 taken 649 times.
✓ Branch 1 taken 17 times.
|
666 | if(tempitem.misc4) |
| 7084 | { | ||
| 7085 | 17 | tempitem.weap_data.lift_level = tempitem.misc4; | |
| 7086 | 17 | tempitem.weap_data.lift_time = tempitem.misc5; | |
| 7087 | 17 | tempitem.weap_data.lift_height = tempitem.misc6; | |
| 7088 | 17 | tempitem.misc4 = 0; | |
| 7089 | 17 | tempitem.misc5 = 0; | |
| 7090 | 17 | tempitem.misc6 = 0; | |
| 7091 | 17 | } | |
| 7092 | 666 | break; | |
| 7093 | } | ||
| 7094 | } | ||
| 7095 | |||
| 7096 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 105506 times.
|
105506 | if (!should_skip) |
| 7097 | { | ||
| 7098 |
1/2✓ Branch 0 taken 105506 times.
✗ Branch 1 not taken.
|
105506 | if(loading_tileset_flags & TILESET_CLEARSCRIPTS) |
| 7099 | { | ||
| 7100 | ✗ | tempitem.script = 0; | |
| 7101 | ✗ | tempitem.weap_data.script = 0; | |
| 7102 | ✗ | for(int q = 0; q < 8; ++q) | |
| 7103 | { | ||
| 7104 | ✗ | tempitem.initiald[q] = 0; | |
| 7105 | ✗ | tempitem.weap_data.initd[q] = 0; | |
| 7106 | ✗ | } | |
| 7107 | ✗ | } | |
| 7108 | 105506 | itemsbuf[i] = tempitem; | |
| 7109 | 105506 | } | |
| 7110 | 105506 | } | |
| 7111 | |||
| 7112 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 478 times.
|
479 | if (should_skip) |
| 7113 | 1 | return 0; | |
| 7114 | |||
| 7115 | ////////////////////////////////////////////////////// | ||
| 7116 | // Now do any updates because of new item additions | ||
| 7117 | // (These can't be done above because items_to_read | ||
| 7118 | // might be too low.) | ||
| 7119 | ////////////////////////////////////////////////////// | ||
| 7120 |
2/2✓ Branch 0 taken 122368 times.
✓ Branch 1 taken 478 times.
|
122846 | for(int32_t i=0; i<MAXITEMS; i++) |
| 7121 | { | ||
| 7122 | 122368 | tempitem = itemsbuf[i]; | |
| 7123 | |||
| 7124 | //Account for older quests that didn't have an actual item for the used letter | ||
| 7125 |
4/4✓ Branch 0 taken 20992 times.
✓ Branch 1 taken 101376 times.
✓ Branch 2 taken 20910 times.
✓ Branch 3 taken 82 times.
|
122368 | if(s_version < 2 && i==iLetterUsed) |
| 7126 | { | ||
| 7127 | 82 | reset_itembuf(&tempitem, iLetterUsed); | |
| 7128 | 82 | strcpy(item_string[i],old_item_string[i]); | |
| 7129 | 82 | tempitem.tile = itemsbuf[iLetter].tile; | |
| 7130 | 82 | tempitem.csets = itemsbuf[iLetter].csets; | |
| 7131 | 82 | tempitem.misc_flags = itemsbuf[iLetter].misc_flags; | |
| 7132 | 82 | tempitem.frames = itemsbuf[iLetter].frames; | |
| 7133 | 82 | tempitem.speed = itemsbuf[iLetter].speed; | |
| 7134 | 82 | tempitem.ltm = itemsbuf[iLetter].ltm; | |
| 7135 | 82 | } | |
| 7136 | |||
| 7137 |
2/2✓ Branch 0 taken 101376 times.
✓ Branch 1 taken 20992 times.
|
122368 | if(s_version < 3) |
| 7138 | { | ||
| 7139 |
3/3✓ Branch 0 taken 1804 times.
✓ Branch 1 taken 19106 times.
✓ Branch 2 taken 82 times.
|
20992 | switch(i) |
| 7140 | { | ||
| 7141 | case iRocsFeather: | ||
| 7142 | case iHoverBoots: | ||
| 7143 | case iSpinScroll: | ||
| 7144 | case iL2SpinScroll: | ||
| 7145 | case iCrossScroll: | ||
| 7146 | case iQuakeScroll: | ||
| 7147 | case iL2QuakeScroll: | ||
| 7148 | case iWhispRing: | ||
| 7149 | case iL2WhispRing: | ||
| 7150 | case iChargeRing: | ||
| 7151 | case iL2ChargeRing: | ||
| 7152 | case iPerilScroll: | ||
| 7153 | case iWalletL3: | ||
| 7154 | case iQuiverL4: | ||
| 7155 | case iBombBagL4: | ||
| 7156 | case iBracelet: | ||
| 7157 | case iL2Bracelet: | ||
| 7158 | case iOldGlove: | ||
| 7159 | case iL2Ladder: | ||
| 7160 | case iWealthMedal: | ||
| 7161 | case iL2WealthMedal: | ||
| 7162 | case iL3WealthMedal: | ||
| 7163 | 1804 | reset_itembuf(&tempitem, i); | |
| 7164 | 1804 | strcpy(item_string[i],old_item_string[i]); | |
| 7165 | 1804 | break; | |
| 7166 | |||
| 7167 | case iSShield: | ||
| 7168 | 82 | reset_itembuf(&tempitem, i); | |
| 7169 | 82 | strcpy(item_string[i],old_item_string[i]); | |
| 7170 | 82 | strcpy(item_string[iShield],old_item_string[iShield]); | |
| 7171 | 82 | strcpy(item_string[iMShield],old_item_string[iMShield]); | |
| 7172 | 82 | break; | |
| 7173 | } | ||
| 7174 | 20992 | } | |
| 7175 | |||
| 7176 |
2/2✓ Branch 0 taken 101376 times.
✓ Branch 1 taken 20992 times.
|
122368 | if(s_version < 5) |
| 7177 | { | ||
| 7178 |
2/2✓ Branch 0 taken 574 times.
✓ Branch 1 taken 20418 times.
|
20992 | switch(i) |
| 7179 | { | ||
| 7180 | case iHeartRing: | ||
| 7181 | case iL2HeartRing: | ||
| 7182 | case iL3HeartRing: | ||
| 7183 | case iMagicRing: | ||
| 7184 | case iL2MagicRing: | ||
| 7185 | case iL3MagicRing: | ||
| 7186 | case iL4MagicRing: | ||
| 7187 | 574 | reset_itembuf(&tempitem, i); | |
| 7188 | 574 | strcpy(item_string[i],old_item_string[i]); | |
| 7189 | 574 | break; | |
| 7190 | } | ||
| 7191 | 20992 | } | |
| 7192 | |||
| 7193 |
2/2✓ Branch 0 taken 101376 times.
✓ Branch 1 taken 20992 times.
|
122368 | if(s_version < 6) // April 2007: Advanced item editing capabilities. |
| 7194 | { | ||
| 7195 |
4/4✓ Branch 0 taken 20910 times.
✓ Branch 1 taken 82 times.
✓ Branch 2 taken 82 times.
✓ Branch 3 taken 20828 times.
|
20992 | if(i!=iBPotion && i!=iRPotion) |
| 7196 |
2/2✓ Branch 0 taken 1524 times.
✓ Branch 1 taken 19304 times.
|
20828 | if (get_bit(deprecated_rules,32)) tempitem.flags |= item_keep_old; |
| 7197 | |||
| 7198 |
43/43✓ Branch 0 taken 82 times.
✓ Branch 1 taken 82 times.
✓ Branch 2 taken 82 times.
✓ Branch 3 taken 82 times.
✓ Branch 4 taken 82 times.
✓ Branch 5 taken 82 times.
✓ Branch 6 taken 82 times.
✓ Branch 7 taken 82 times.
✓ Branch 8 taken 82 times.
✓ Branch 9 taken 82 times.
✓ Branch 10 taken 328 times.
✓ Branch 11 taken 17302 times.
✓ Branch 12 taken 82 times.
✓ Branch 13 taken 82 times.
✓ Branch 14 taken 82 times.
✓ Branch 15 taken 82 times.
✓ Branch 16 taken 82 times.
✓ Branch 17 taken 82 times.
✓ Branch 18 taken 82 times.
✓ Branch 19 taken 82 times.
✓ Branch 20 taken 82 times.
✓ Branch 21 taken 82 times.
✓ Branch 22 taken 82 times.
✓ Branch 23 taken 82 times.
✓ Branch 24 taken 82 times.
✓ Branch 25 taken 82 times.
✓ Branch 26 taken 82 times.
✓ Branch 27 taken 82 times.
✓ Branch 28 taken 82 times.
✓ Branch 29 taken 82 times.
✓ Branch 30 taken 82 times.
✓ Branch 31 taken 82 times.
✓ Branch 32 taken 82 times.
✓ Branch 33 taken 82 times.
✓ Branch 34 taken 82 times.
✓ Branch 35 taken 82 times.
✓ Branch 36 taken 82 times.
✓ Branch 37 taken 82 times.
✓ Branch 38 taken 82 times.
✓ Branch 39 taken 82 times.
✓ Branch 40 taken 82 times.
✓ Branch 41 taken 82 times.
✓ Branch 42 taken 82 times.
|
20992 | switch(i) |
| 7199 | { | ||
| 7200 | case iTriforce: | ||
| 7201 | 82 | tempitem.fam_type=1; | |
| 7202 | 82 | break; | |
| 7203 | |||
| 7204 | case iBigTri: | ||
| 7205 | 82 | tempitem.fam_type=0; | |
| 7206 | 82 | break; | |
| 7207 | |||
| 7208 | case iBombs: | ||
| 7209 | 82 | tempitem.fam_type=i_bomb; | |
| 7210 | 82 | tempitem.power=4; | |
| 7211 | 82 | tempitem.wpn=wBOMB; | |
| 7212 | 82 | tempitem.wpn2=wBOOM; | |
| 7213 | 82 | tempitem.misc1 = 50; | |
| 7214 | |||
| 7215 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 82 times.
|
82 | if(get_bit(deprecated_rules,qr_SLOWBOMBFUSES_DEP)) tempitem.misc1 = 200; |
| 7216 | |||
| 7217 | 82 | break; | |
| 7218 | |||
| 7219 | case iSBomb: | ||
| 7220 | 82 | tempitem.fam_type=i_sbomb; | |
| 7221 | 82 | tempitem.power=16; | |
| 7222 | 82 | tempitem.wpn=wSBOMB; | |
| 7223 | 82 | tempitem.wpn2=wSBOOM; | |
| 7224 | 82 | tempitem.misc1 = 50; | |
| 7225 | |||
| 7226 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 82 times.
|
82 | if(get_bit(deprecated_rules,qr_SLOWBOMBFUSES_DEP)) tempitem.misc1 = 400; |
| 7227 | |||
| 7228 | 82 | break; | |
| 7229 | |||
| 7230 | case iBook: | ||
| 7231 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 82 times.
|
82 | if(get_bit(deprecated_rules, qr_FIREMAGICSPRITE_DEP)) |
| 7232 | ✗ | tempitem.wpn = wFIREMAGIC; | |
| 7233 | |||
| 7234 | 82 | break; | |
| 7235 | |||
| 7236 | case iSArrow: | ||
| 7237 | 82 | tempitem.wpn2 = get_bit(deprecated_rules,27) ? wSSPARKLE : 0; //qr_SASPARKLES | |
| 7238 | 82 | tempitem.power=4; | |
| 7239 | 82 | tempitem.flags|=item_gamedata; | |
| 7240 | 82 | tempitem.wpn=wSARROW; | |
| 7241 | 82 | break; | |
| 7242 | |||
| 7243 | case iGArrow: | ||
| 7244 | 82 | tempitem.wpn2 = get_bit(deprecated_rules,28) ? wGSPARKLE : 0; //qr_GASPARKLES | |
| 7245 | 82 | tempitem.power=8; | |
| 7246 | 82 | tempitem.flags|=(item_gamedata|item_flag1); | |
| 7247 | 82 | tempitem.wpn=wGARROW; | |
| 7248 | 82 | break; | |
| 7249 | |||
| 7250 | case iBrang: | ||
| 7251 | 82 | tempitem.power=0; | |
| 7252 | 82 | tempitem.wpn=wBRANG; | |
| 7253 | 82 | tempitem.misc1=36; | |
| 7254 | 82 | break; | |
| 7255 | |||
| 7256 | case iMBrang: | ||
| 7257 | 82 | tempitem.wpn2 = get_bit(deprecated_rules,29) ? wMSPARKLE : 0; //qr_MBSPARKLES | |
| 7258 | 82 | tempitem.power=0; | |
| 7259 | 82 | tempitem.wpn=wMBRANG; | |
| 7260 | 82 | break; | |
| 7261 | |||
| 7262 | case iFBrang: | ||
| 7263 | 82 | tempitem.wpn3 = get_bit(deprecated_rules,30) ? wFSPARKLE : 0; //qr_FBSPARKLES | |
| 7264 | 82 | tempitem.power=2; | |
| 7265 | 82 | tempitem.wpn=wFBRANG; | |
| 7266 | 82 | break; | |
| 7267 | |||
| 7268 | case iBoots: | ||
| 7269 | 82 | tempitem.cost_amount[0] = get_bit(deprecated_rules,qr_MAGICBOOTS_DEP) ? 1 : 0; | |
| 7270 | 82 | tempitem.power=7; | |
| 7271 | 82 | break; | |
| 7272 | |||
| 7273 | case iWand: | ||
| 7274 | 82 | tempitem.cost_amount[0] = get_bit(deprecated_rules,qr_MAGICWAND_DEP) ? 8 : 0; | |
| 7275 | 82 | tempitem.power=2; | |
| 7276 | 82 | tempitem.wpn=wWAND; | |
| 7277 | 82 | tempitem.wpn3=wMAGIC; | |
| 7278 | 82 | break; | |
| 7279 | |||
| 7280 | case iBCandle: | ||
| 7281 | 82 | tempitem.cost_amount[0] = get_bit(deprecated_rules,qr_MAGICCANDLE_DEP) ? 4 : 0; | |
| 7282 | 82 | tempitem.power=1; | |
| 7283 | 82 | tempitem.flags|=(item_gamedata|item_flag1); | |
| 7284 | 82 | tempitem.wpn3=wFIRE; | |
| 7285 | 82 | break; | |
| 7286 | |||
| 7287 | case iRCandle: | ||
| 7288 | 82 | tempitem.cost_amount[0] = get_bit(deprecated_rules,qr_MAGICCANDLE_DEP) ? 4 : 0; | |
| 7289 | 82 | tempitem.power=1; | |
| 7290 | 82 | tempitem.wpn3=wFIRE; | |
| 7291 | 82 | break; | |
| 7292 | |||
| 7293 | case iSword: | ||
| 7294 | 82 | tempitem.power=1; | |
| 7295 | 82 | tempitem.flags|= item_flag4 |item_flag2; | |
| 7296 | 82 | tempitem.wpn=tempitem.wpn3=wSWORD; | |
| 7297 | 82 | tempitem.wpn2=wSWORDSLASH; | |
| 7298 | 82 | break; | |
| 7299 | |||
| 7300 | case iWSword: | ||
| 7301 | 82 | tempitem.power=2; | |
| 7302 | 82 | tempitem.flags|= item_flag4 |item_flag2; | |
| 7303 | 82 | tempitem.wpn=tempitem.wpn3=wWSWORD; | |
| 7304 | 82 | tempitem.wpn2=wWSWORDSLASH; | |
| 7305 | 82 | break; | |
| 7306 | |||
| 7307 | case iMSword: | ||
| 7308 | 82 | tempitem.power=4; | |
| 7309 | 82 | tempitem.flags|= item_flag4 |item_flag2; | |
| 7310 | 82 | tempitem.wpn=tempitem.wpn3=wMSWORD; | |
| 7311 | 82 | tempitem.wpn2=wMSWORDSLASH; | |
| 7312 | 82 | break; | |
| 7313 | |||
| 7314 | case iXSword: | ||
| 7315 | 82 | tempitem.power=8; | |
| 7316 | 82 | tempitem.flags|= item_flag4 |item_flag2; | |
| 7317 | 82 | tempitem.wpn=tempitem.wpn3=wXSWORD; | |
| 7318 | 82 | tempitem.wpn2=wXSWORDSLASH; | |
| 7319 | 82 | break; | |
| 7320 | |||
| 7321 | case iDivineProtection: | ||
| 7322 | 82 | tempitem.flags |= get_bit(deprecated_rules,qr_FLICKERINGDIVINEPROTECTIONROCKET_DEP) ? item_flag1 : item_none; | |
| 7323 | 82 | tempitem.flags |= get_bit(deprecated_rules,qr_TRANSLUCENTDIVINEPROTECTIONROCKET_DEP) ? item_flag2 : item_none; | |
| 7324 | 82 | tempitem.wpn=wDIVINEPROTECTION1A; | |
| 7325 | 82 | tempitem.wpn2=wDIVINEPROTECTION1B; | |
| 7326 | 82 | tempitem.wpn3=wDIVINEPROTECTIONS1A; | |
| 7327 | 82 | tempitem.wpn4=wDIVINEPROTECTIONS1B; | |
| 7328 | 82 | tempitem.wpn6=wDIVINEPROTECTION2A; | |
| 7329 | 82 | tempitem.wpn7=wDIVINEPROTECTION2B; | |
| 7330 | 82 | tempitem.wpn8=wDIVINEPROTECTIONS2A; | |
| 7331 | 82 | tempitem.wpn9=wDIVINEPROTECTIONS2B; | |
| 7332 | 82 | tempitem.wpn5 = iwDivineProtectionShieldFront; | |
| 7333 | 82 | tempitem.wpn10 = iwDivineProtectionShieldBack; | |
| 7334 | 82 | tempitem.misc1=512; | |
| 7335 | 82 | tempitem.cost_amount[0]=64; | |
| 7336 | 82 | break; | |
| 7337 | |||
| 7338 | case iLens: | ||
| 7339 | 82 | tempitem.misc1=60; | |
| 7340 | 82 | tempitem.flags |= get_qr(qr_ENABLEMAGIC) ? item_none : item_rupee_magic; | |
| 7341 | 82 | tempitem.cost_amount[0] = get_qr(qr_ENABLEMAGIC) ? 2 : 1; | |
| 7342 | 82 | break; | |
| 7343 | |||
| 7344 | case iArrow: | ||
| 7345 | 82 | tempitem.power=2; | |
| 7346 | 82 | tempitem.wpn=wARROW; | |
| 7347 | 82 | break; | |
| 7348 | |||
| 7349 | case iHoverBoots: | ||
| 7350 | 82 | tempitem.misc1=45; | |
| 7351 | 82 | tempitem.wpn=iwHover; | |
| 7352 | 82 | break; | |
| 7353 | |||
| 7354 | case iDivineFire: | ||
| 7355 | 82 | tempitem.power=8; | |
| 7356 | 82 | tempitem.wpn=wDIVINEFIRE1A; | |
| 7357 | 82 | tempitem.wpn2=wDIVINEFIRE1B; | |
| 7358 | 82 | tempitem.wpn3=wDIVINEFIRES1A; | |
| 7359 | 82 | tempitem.wpn4=wDIVINEFIRES1B; | |
| 7360 | 82 | tempitem.misc1 = 32; | |
| 7361 | 82 | tempitem.misc2 = 200; | |
| 7362 | 82 | tempitem.cost_amount[0]=32; | |
| 7363 | 82 | break; | |
| 7364 | |||
| 7365 | case iDivineEscape: | ||
| 7366 | 82 | tempitem.cost_amount[0]=32; | |
| 7367 | 82 | break; | |
| 7368 | |||
| 7369 | case iHookshot: | ||
| 7370 | 82 | tempitem.power=0; | |
| 7371 | 82 | tempitem.flags&=~item_flag1; | |
| 7372 | 82 | tempitem.wpn=wHSHEAD; | |
| 7373 | 82 | tempitem.wpn2=wHSCHAIN_H; | |
| 7374 | 82 | tempitem.wpn4=wHSHANDLE; | |
| 7375 | 82 | tempitem.wpn3=wHSCHAIN_V; | |
| 7376 | 82 | tempitem.misc1=50; | |
| 7377 | 82 | tempitem.misc2=100; | |
| 7378 | 82 | break; | |
| 7379 | |||
| 7380 | case iLongshot: | ||
| 7381 | 82 | tempitem.power=0; | |
| 7382 | 82 | tempitem.flags&=~item_flag1; | |
| 7383 | 82 | tempitem.wpn=wLSHEAD; | |
| 7384 | 82 | tempitem.wpn2=wLSCHAIN_H; | |
| 7385 | 82 | tempitem.wpn4=wLSHANDLE; | |
| 7386 | 82 | tempitem.wpn3=wLSCHAIN_V; | |
| 7387 | 82 | tempitem.misc1=99; | |
| 7388 | 82 | tempitem.misc2=100; | |
| 7389 | 82 | break; | |
| 7390 | |||
| 7391 | case iHammer: | ||
| 7392 | 82 | tempitem.power=4; | |
| 7393 | 82 | tempitem.wpn=wHAMMER; | |
| 7394 | 82 | tempitem.wpn2=iwHammerSmack; | |
| 7395 | 82 | break; | |
| 7396 | |||
| 7397 | case iCByrna: | ||
| 7398 | 82 | tempitem.power=1; | |
| 7399 | 82 | tempitem.wpn=wCBYRNA; | |
| 7400 | 82 | tempitem.wpn2=wCBYRNASLASH; | |
| 7401 | 82 | tempitem.wpn3=wCBYRNAORB; | |
| 7402 | 82 | tempitem.misc1=4; | |
| 7403 | 82 | tempitem.misc2=16; | |
| 7404 | 82 | tempitem.misc3=1; | |
| 7405 | 82 | tempitem.cost_amount[0]=1; | |
| 7406 | 82 | break; | |
| 7407 | |||
| 7408 | case iWhistle: | ||
| 7409 | 82 | tempitem.wpn=wWIND; | |
| 7410 | 82 | tempitem.misc1=3; | |
| 7411 | 82 | tempitem.flags|=item_flag1; | |
| 7412 | 82 | break; | |
| 7413 | |||
| 7414 | case iBRing: | ||
| 7415 | 82 | tempitem.power=2; | |
| 7416 | 82 | tempitem.misc1=spBLUE; | |
| 7417 | 82 | break; | |
| 7418 | |||
| 7419 | case iRRing: | ||
| 7420 | 82 | tempitem.power=4; | |
| 7421 | 82 | tempitem.misc1=spRED; | |
| 7422 | 82 | break; | |
| 7423 | |||
| 7424 | case iGRing: | ||
| 7425 | 82 | tempitem.power=8; | |
| 7426 | 82 | tempitem.misc1=spGOLD; | |
| 7427 | 82 | break; | |
| 7428 | |||
| 7429 | case iSpinScroll: | ||
| 7430 | 82 | tempitem.power = 2; | |
| 7431 | 82 | tempitem.misc1 = 1; | |
| 7432 | 82 | break; | |
| 7433 | |||
| 7434 | case iL2SpinScroll: | ||
| 7435 | 82 | tempitem.family=itype_spinscroll2; | |
| 7436 | 82 | tempitem.fam_type=1; | |
| 7437 | 82 | tempitem.cost_amount[0]=8; | |
| 7438 | 82 | tempitem.power=2; | |
| 7439 | 82 | tempitem.misc1 = 20; | |
| 7440 | 82 | break; | |
| 7441 | |||
| 7442 | case iQuakeScroll: | ||
| 7443 | 82 | tempitem.misc1=0x10; | |
| 7444 | 82 | tempitem.misc2=64; | |
| 7445 | 82 | break; | |
| 7446 | |||
| 7447 | case iL2QuakeScroll: | ||
| 7448 | 82 | tempitem.family=itype_quakescroll2; | |
| 7449 | 82 | tempitem.fam_type=1; | |
| 7450 | 82 | tempitem.power = 2; | |
| 7451 | 82 | tempitem.misc1=0x20; | |
| 7452 | 82 | tempitem.misc2=192; | |
| 7453 | 82 | tempitem.cost_amount[0]=8; | |
| 7454 | 82 | break; | |
| 7455 | |||
| 7456 | case iChargeRing: | ||
| 7457 | 82 | tempitem.misc1=64; | |
| 7458 | 82 | tempitem.misc2=128; | |
| 7459 | 82 | break; | |
| 7460 | |||
| 7461 | case iL2ChargeRing: | ||
| 7462 | 82 | tempitem.misc1=32; | |
| 7463 | 82 | tempitem.misc2=64; | |
| 7464 | 82 | break; | |
| 7465 | |||
| 7466 | case iOldGlove: | ||
| 7467 | 82 | tempitem.flags |= item_flag1; | |
| 7468 | |||
| 7469 | //fallthrough | ||
| 7470 | case iBombBagL4: | ||
| 7471 | case iWalletL3: | ||
| 7472 | case iQuiverL4: | ||
| 7473 | case iBracelet: | ||
| 7474 | 410 | tempitem.power = 1; | |
| 7475 | 410 | break; | |
| 7476 | |||
| 7477 | case iL2Bracelet: | ||
| 7478 | 82 | tempitem.power = 2; | |
| 7479 | 82 | break; | |
| 7480 | |||
| 7481 | case iMKey: | ||
| 7482 | 82 | tempitem.power=0xFF; | |
| 7483 | 82 | tempitem.flags |= item_flag1; | |
| 7484 | 82 | break; | |
| 7485 | } | ||
| 7486 | 20992 | } | |
| 7487 | |||
| 7488 |
2/2✓ Branch 0 taken 101376 times.
✓ Branch 1 taken 20992 times.
|
122368 | if(s_version < 7) |
| 7489 | { | ||
| 7490 |
2/2✓ Branch 0 taken 328 times.
✓ Branch 1 taken 20664 times.
|
20992 | switch(i) |
| 7491 | { | ||
| 7492 | case iStoneAgony: | ||
| 7493 | case iStompBoots: | ||
| 7494 | case iPerilRing: | ||
| 7495 | case iWhimsicalRing: | ||
| 7496 | { | ||
| 7497 | 328 | reset_itembuf(&tempitem, i); | |
| 7498 | 328 | strcpy(item_string[i],old_item_string[i]); | |
| 7499 | 328 | break; | |
| 7500 | } | ||
| 7501 | } | ||
| 7502 | 20992 | } | |
| 7503 | |||
| 7504 |
2/2✓ Branch 0 taken 101376 times.
✓ Branch 1 taken 20992 times.
|
122368 | if(s_version < 8) // May 2007: Some corrections. |
| 7505 | { | ||
| 7506 |
7/7✓ Branch 0 taken 82 times.
✓ Branch 1 taken 246 times.
✓ Branch 2 taken 20336 times.
✓ Branch 3 taken 82 times.
✓ Branch 4 taken 82 times.
✓ Branch 5 taken 82 times.
✓ Branch 6 taken 82 times.
|
20992 | switch(i) |
| 7507 | { | ||
| 7508 | case iMShield: | ||
| 7509 | 82 | tempitem.misc1|=sh_flame; | |
| 7510 | 82 | tempitem.misc2|=sh_fireball|sh_magic; | |
| 7511 | |||
| 7512 |
1/2✓ Branch 0 taken 82 times.
✗ Branch 1 not taken.
|
82 | if(get_qr(qr_SWORDMIRROR)) |
| 7513 | { | ||
| 7514 | ✗ | tempitem.misc2 |= sh_sword; | |
| 7515 | ✗ | } | |
| 7516 | |||
| 7517 | // fallthrough | ||
| 7518 | case iShield: | ||
| 7519 | 164 | tempitem.misc1|=sh_fireball|sh_sword|sh_magic; | |
| 7520 | |||
| 7521 | // fallthrough | ||
| 7522 | case iSShield: | ||
| 7523 | 246 | tempitem.misc1|=sh_rock|sh_arrow|sh_brang|sh_script; | |
| 7524 | |||
| 7525 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 246 times.
|
246 | if(get_bit(deprecated_rules,102)) //qr_REFLECTROCKS |
| 7526 | { | ||
| 7527 | ✗ | tempitem.misc2 |= sh_rock; | |
| 7528 | ✗ | } | |
| 7529 | |||
| 7530 | 246 | break; | |
| 7531 | |||
| 7532 | case iWhispRing: | ||
| 7533 | 82 | tempitem.power=1; | |
| 7534 | 82 | tempitem.flags|=item_gamedata|item_flag1; | |
| 7535 | 82 | tempitem.misc1 = 3; | |
| 7536 | 82 | break; | |
| 7537 | |||
| 7538 | case iL2WhispRing: | ||
| 7539 | 82 | tempitem.power=0; | |
| 7540 | 82 | tempitem.flags|=item_gamedata|item_flag1; | |
| 7541 | 82 | tempitem.misc1 = 3; | |
| 7542 | 82 | break; | |
| 7543 | |||
| 7544 | case iL2Ladder: | ||
| 7545 | case iBow: | ||
| 7546 | case iCByrna: | ||
| 7547 | 246 | tempitem.power = 1; | |
| 7548 | 246 | break; | |
| 7549 | } | ||
| 7550 | 20992 | } | |
| 7551 | |||
| 7552 |
4/4✓ Branch 0 taken 20992 times.
✓ Branch 1 taken 101376 times.
✓ Branch 2 taken 20910 times.
✓ Branch 3 taken 82 times.
|
122368 | if(s_version < 9 && i==iClock) |
| 7553 | { | ||
| 7554 | 82 | tempitem.misc1 = get_bit(deprecated_rules, qr_TEMPCLOCKS_DEP) ? 256 : 0; | |
| 7555 | 82 | } | |
| 7556 | |||
| 7557 | //add the misc flag for bomb | ||
| 7558 |
4/4✓ Branch 0 taken 20992 times.
✓ Branch 1 taken 101376 times.
✓ Branch 2 taken 20910 times.
✓ Branch 3 taken 82 times.
|
122368 | if(s_version < 10 && tempitem.family == itype_bomb) |
| 7559 | { | ||
| 7560 | 82 | tempitem.flags = (tempitem.flags & ~item_flag1) | (get_qr(qr_LONGBOMBBOOM_DEP) ? item_flag1 : item_none); | |
| 7561 | 82 | } | |
| 7562 | |||
| 7563 |
4/4✓ Branch 0 taken 20992 times.
✓ Branch 1 taken 101376 times.
✓ Branch 2 taken 20828 times.
✓ Branch 3 taken 164 times.
|
122368 | if(s_version < 11 && tempitem.family == itype_triforcepiece) |
| 7564 | { | ||
| 7565 | 164 | tempitem.flags = (tempitem.fam_type ? item_gamedata : item_none); | |
| 7566 | 164 | tempitem.playsound = (tempitem.fam_type ? WAV_SCALE : WAV_CLEARED); | |
| 7567 | 164 | } | |
| 7568 | |||
| 7569 |
2/2✓ Branch 0 taken 101376 times.
✓ Branch 1 taken 20992 times.
|
122368 | if(s_version < 12) // June 2007: More Misc. attributes. |
| 7570 | { | ||
| 7571 |
5/5✓ Branch 0 taken 164 times.
✓ Branch 1 taken 20582 times.
✓ Branch 2 taken 82 times.
✓ Branch 3 taken 82 times.
✓ Branch 4 taken 82 times.
|
20992 | switch(i) |
| 7572 | { | ||
| 7573 | case iFBrang: | ||
| 7574 | 82 | tempitem.misc4 |= sh_fireball|sh_sword|sh_magic; | |
| 7575 | |||
| 7576 | //fallthrough | ||
| 7577 | case iMBrang: | ||
| 7578 | 164 | tempitem.misc3 |= sh_sword|sh_magic; | |
| 7579 | |||
| 7580 | //fallthrough | ||
| 7581 | case iHookshot: | ||
| 7582 | case iLongshot: | ||
| 7583 | //fallthrough | ||
| 7584 | 328 | tempitem.misc3 |= sh_fireball; | |
| 7585 | |||
| 7586 | case iBrang: | ||
| 7587 | 410 | tempitem.misc3 |= sh_brang|sh_rock|sh_arrow; | |
| 7588 | 410 | break; | |
| 7589 | } | ||
| 7590 | |||
| 7591 |
16/16✓ Branch 0 taken 82 times.
✓ Branch 1 taken 82 times.
✓ Branch 2 taken 246 times.
✓ Branch 3 taken 246 times.
✓ Branch 4 taken 82 times.
✓ Branch 5 taken 82 times.
✓ Branch 6 taken 82 times.
✓ Branch 7 taken 328 times.
✓ Branch 8 taken 164 times.
✓ Branch 9 taken 9629 times.
✓ Branch 10 taken 82 times.
✓ Branch 11 taken 164 times.
✓ Branch 12 taken 246 times.
✓ Branch 13 taken 9313 times.
✓ Branch 14 taken 82 times.
✓ Branch 15 taken 82 times.
|
20992 | switch(tempitem.family) |
| 7592 | { | ||
| 7593 | case itype_hoverboots: | ||
| 7594 | 82 | tempitem.usesound = WAV_ZN1HOVER; | |
| 7595 | 82 | break; | |
| 7596 | |||
| 7597 | case itype_wand: | ||
| 7598 | 82 | tempitem.usesound = WAV_WAND; | |
| 7599 | 82 | break; | |
| 7600 | |||
| 7601 | case itype_book: | ||
| 7602 | 82 | tempitem.usesound = WAV_FIRE; | |
| 7603 | 82 | break; | |
| 7604 | |||
| 7605 | case itype_arrow: | ||
| 7606 | 246 | tempitem.usesound = WAV_ARROW; | |
| 7607 | 246 | break; | |
| 7608 | |||
| 7609 | case itype_hookshot: | ||
| 7610 | 164 | tempitem.usesound = WAV_HOOKSHOT; | |
| 7611 | 164 | break; | |
| 7612 | |||
| 7613 | case itype_brang: | ||
| 7614 | 246 | tempitem.usesound = WAV_BRANG; | |
| 7615 | 246 | break; | |
| 7616 | |||
| 7617 | case itype_shield: | ||
| 7618 | 246 | tempitem.usesound = WAV_CHINK; | |
| 7619 | 246 | break; | |
| 7620 | |||
| 7621 | case itype_sword: | ||
| 7622 | 9313 | tempitem.usesound = WAV_SWORD; | |
| 7623 | 9313 | break; | |
| 7624 | |||
| 7625 | case itype_whistle: | ||
| 7626 | 82 | tempitem.usesound = WAV_WHISTLE; | |
| 7627 | 82 | break; | |
| 7628 | |||
| 7629 | case itype_hammer: | ||
| 7630 | 82 | tempitem.usesound = WAV_HAMMER; | |
| 7631 | 82 | break; | |
| 7632 | |||
| 7633 | case itype_divinefire: | ||
| 7634 | 82 | tempitem.usesound = WAV_ZN1DIVINEFIRE; | |
| 7635 | 82 | break; | |
| 7636 | |||
| 7637 | case itype_divineescape: | ||
| 7638 | 82 | tempitem.usesound = WAV_ZN1DIVINEESCAPE; | |
| 7639 | 82 | break; | |
| 7640 | |||
| 7641 | case itype_divineprotection: | ||
| 7642 | 82 | tempitem.usesound = WAV_ZN1DIVINEPROTECTION1; | |
| 7643 | 82 | break; | |
| 7644 | |||
| 7645 | case itype_bomb: | ||
| 7646 | case itype_sbomb: | ||
| 7647 | case itype_quakescroll: | ||
| 7648 | case itype_quakescroll2: | ||
| 7649 | 328 | tempitem.usesound = WAV_BOMB; | |
| 7650 | 328 | break; | |
| 7651 | |||
| 7652 | case itype_spinscroll: | ||
| 7653 | case itype_spinscroll2: | ||
| 7654 | 164 | tempitem.usesound = WAV_ZN1SPINATTACK; | |
| 7655 | 164 | break; | |
| 7656 | } | ||
| 7657 | 20992 | } | |
| 7658 | |||
| 7659 |
2/2✓ Branch 0 taken 101376 times.
✓ Branch 1 taken 20992 times.
|
122368 | if(s_version < 13) // July 2007 |
| 7660 | { | ||
| 7661 |
2/2✓ Branch 0 taken 82 times.
✓ Branch 1 taken 20910 times.
|
20992 | if(tempitem.family == itype_whistle) |
| 7662 | { | ||
| 7663 | 82 | tempitem.misc1 = (tempitem.power==2 ? 4 : 3); | |
| 7664 | 82 | tempitem.power = 1; | |
| 7665 | 82 | tempitem.flags|=item_flag1; | |
| 7666 | 82 | } | |
| 7667 |
2/2✓ Branch 0 taken 82 times.
✓ Branch 1 taken 20828 times.
|
20910 | else if(tempitem.family == itype_wand) |
| 7668 | 82 | tempitem.flags|=item_flag1; | |
| 7669 |
2/2✓ Branch 0 taken 20746 times.
✓ Branch 1 taken 82 times.
|
20828 | else if(tempitem.family == itype_book) |
| 7670 | { | ||
| 7671 | 82 | tempitem.flags|=item_flag1; | |
| 7672 | 82 | tempitem.power = 2; | |
| 7673 | 82 | } | |
| 7674 | 20992 | } | |
| 7675 | |||
| 7676 |
2/2✓ Branch 0 taken 101376 times.
✓ Branch 1 taken 20992 times.
|
122368 | if(s_version < 14) // August 2007 |
| 7677 | { | ||
| 7678 |
2/2✓ Branch 0 taken 164 times.
✓ Branch 1 taken 20828 times.
|
20992 | if(tempitem.family == itype_fairy) |
| 7679 | { | ||
| 7680 | 164 | tempitem.usesound = WAV_SCALE; | |
| 7681 | |||
| 7682 |
1/2✓ Branch 0 taken 164 times.
✗ Branch 1 not taken.
|
164 | if(tempitem.fam_type) |
| 7683 | 164 | tempitem.misc3=50; | |
| 7684 | 164 | } | |
| 7685 |
2/2✓ Branch 0 taken 20664 times.
✓ Branch 1 taken 164 times.
|
20828 | else if(tempitem.family == itype_potion) |
| 7686 | { | ||
| 7687 | 164 | tempitem.flags |= item_gain_old; | |
| 7688 | 164 | } | |
| 7689 | 20992 | } | |
| 7690 | |||
| 7691 |
2/2✓ Branch 0 taken 101376 times.
✓ Branch 1 taken 20992 times.
|
122368 | if(s_version < 17) // November 2007 |
| 7692 | { | ||
| 7693 |
3/4✓ Branch 0 taken 164 times.
✓ Branch 1 taken 20828 times.
✓ Branch 2 taken 164 times.
✗ Branch 3 not taken.
|
20992 | if(tempitem.family == itype_candle && !tempitem.wpn3) |
| 7694 | { | ||
| 7695 | ✗ | tempitem.wpn3 = wFIRE; | |
| 7696 | ✗ | } | |
| 7697 |
4/4✓ Branch 0 taken 246 times.
✓ Branch 1 taken 20746 times.
✓ Branch 2 taken 164 times.
✓ Branch 3 taken 82 times.
|
20992 | else if(tempitem.family == itype_arrow && tempitem.power>4) |
| 7698 | { | ||
| 7699 | 82 | tempitem.flags|=item_flag1; | |
| 7700 | 82 | } | |
| 7701 | 20992 | } | |
| 7702 | |||
| 7703 |
2/2✓ Branch 0 taken 101376 times.
✓ Branch 1 taken 20992 times.
|
122368 | if(s_version < 18) // New Year's Eve 2007 |
| 7704 | { | ||
| 7705 |
2/2✓ Branch 0 taken 82 times.
✓ Branch 1 taken 20910 times.
|
20992 | if(tempitem.family == itype_whistle) |
| 7706 | 82 | tempitem.misc2 = 8; // Use the Whistle warp ring | |
| 7707 |
2/2✓ Branch 0 taken 82 times.
✓ Branch 1 taken 20828 times.
|
20910 | else if(tempitem.family == itype_bait) |
| 7708 | 82 | tempitem.misc1 = 768; // Frames until it goes | |
| 7709 |
2/2✓ Branch 0 taken 20664 times.
✓ Branch 1 taken 164 times.
|
20828 | else if(tempitem.family == itype_triforcepiece) |
| 7710 | { | ||
| 7711 |
2/2✓ Branch 0 taken 82 times.
✓ Branch 1 taken 82 times.
|
164 | if(tempitem.flags & item_gamedata) |
| 7712 | { | ||
| 7713 | 82 | tempitem.misc2 = 1; // Cutscene 1 | |
| 7714 | 82 | tempitem.flags |= item_flag1; // Side Warp Out | |
| 7715 | 82 | } | |
| 7716 | 164 | } | |
| 7717 | 20992 | } | |
| 7718 | |||
| 7719 |
2/2✓ Branch 0 taken 101376 times.
✓ Branch 1 taken 20992 times.
|
122368 | if(s_version < 19) // January 2008 |
| 7720 | { | ||
| 7721 |
2/2✓ Branch 0 taken 20910 times.
✓ Branch 1 taken 82 times.
|
20992 | if(tempitem.family == itype_divineprotection) |
| 7722 | { | ||
| 7723 |
2/2✓ Branch 0 taken 2 times.
✓ Branch 1 taken 80 times.
|
82 | if (get_bit(deprecated_rules,qr_NOBOMBPALFLASH+1)) tempitem.flags |= item_flag3; |
| 7724 |
2/2✓ Branch 0 taken 10 times.
✓ Branch 1 taken 72 times.
|
82 | if (get_bit(deprecated_rules,qr_NOBOMBPALFLASH+2)) tempitem.flags |= item_flag4; |
| 7725 | 82 | } | |
| 7726 | 20992 | } | |
| 7727 | |||
| 7728 |
2/2✓ Branch 0 taken 101376 times.
✓ Branch 1 taken 20992 times.
|
122368 | if(s_version < 20) // October 2008 |
| 7729 | { | ||
| 7730 |
2/2✓ Branch 0 taken 20910 times.
✓ Branch 1 taken 82 times.
|
20992 | if(tempitem.family == itype_divineprotection) |
| 7731 | { | ||
| 7732 | 82 | tempitem.wpn6=wDIVINEPROTECTION2A; | |
| 7733 | 82 | tempitem.wpn7=wDIVINEPROTECTION2B; | |
| 7734 | 82 | tempitem.wpn8=wDIVINEPROTECTIONS2A; | |
| 7735 | 82 | tempitem.wpn9=wDIVINEPROTECTIONS2B; | |
| 7736 | 82 | tempitem.wpn5 = iwDivineProtectionShieldFront; | |
| 7737 | 82 | tempitem.wpn10 = iwDivineProtectionShieldBack; | |
| 7738 | 82 | } | |
| 7739 | 20992 | } | |
| 7740 | |||
| 7741 |
2/2✓ Branch 0 taken 101376 times.
✓ Branch 1 taken 20992 times.
|
122368 | if(s_version < 21) // November 2008 |
| 7742 | { | ||
| 7743 |
1/2✓ Branch 0 taken 20992 times.
✗ Branch 1 not taken.
|
20992 | if(tempitem.flags & 0x0100) // item_slash |
| 7744 | { | ||
| 7745 | ✗ | tempitem.flags &= ~item_unused; | |
| 7746 | |||
| 7747 | ✗ | if(tempitem.family == itype_sword || | |
| 7748 | ✗ | tempitem.family == itype_wand || | |
| 7749 | ✗ | tempitem.family == itype_candle || | |
| 7750 | ✗ | tempitem.family == itype_cbyrna) | |
| 7751 | { | ||
| 7752 | ✗ | tempitem.flags |= item_flag4; | |
| 7753 | ✗ | } | |
| 7754 | ✗ | } | |
| 7755 | 20992 | } | |
| 7756 | |||
| 7757 |
2/2✓ Branch 0 taken 101376 times.
✓ Branch 1 taken 20992 times.
|
122368 | if(s_version < 22) // September 2009 |
| 7758 | { | ||
| 7759 |
4/4✓ Branch 0 taken 20910 times.
✓ Branch 1 taken 82 times.
✓ Branch 2 taken 82 times.
✓ Branch 3 taken 20828 times.
|
20992 | if(tempitem.family == itype_sbomb || tempitem.family == itype_bomb) |
| 7760 | { | ||
| 7761 | 164 | tempitem.misc3 = tempitem.power/2; | |
| 7762 | 164 | } | |
| 7763 | 20992 | } | |
| 7764 | |||
| 7765 |
2/2✓ Branch 0 taken 101376 times.
✓ Branch 1 taken 20992 times.
|
122368 | if(s_version < 23) // March 2011 |
| 7766 | { | ||
| 7767 |
2/2✓ Branch 0 taken 82 times.
✓ Branch 1 taken 20910 times.
|
20992 | if(tempitem.family == itype_divinefire) |
| 7768 | 82 | tempitem.wpn5 = wFIRE; | |
| 7769 |
2/2✓ Branch 0 taken 20828 times.
✓ Branch 1 taken 82 times.
|
20910 | else if(tempitem.family == itype_book) |
| 7770 | 82 | tempitem.wpn2 = wFIRE; | |
| 7771 | 20992 | } | |
| 7772 | |||
| 7773 | // Version 25: Bomb bags were acting as though "super bombs also" was checked | ||
| 7774 | // whether it was or not, and a lot of existing quests depended on the | ||
| 7775 | // incorrect behavior. | ||
| 7776 |
2/2✓ Branch 0 taken 101376 times.
✓ Branch 1 taken 20992 times.
|
122368 | if(s_version < 25) // January 2012 |
| 7777 | { | ||
| 7778 |
2/2✓ Branch 0 taken 20664 times.
✓ Branch 1 taken 328 times.
|
20992 | if(tempitem.family == itype_bombbag) |
| 7779 | 328 | tempitem.flags |= item_flag1; | |
| 7780 | |||
| 7781 |
2/2✓ Branch 0 taken 20910 times.
✓ Branch 1 taken 82 times.
|
20992 | if(tempitem.family == itype_divinefire) |
| 7782 | 82 | tempitem.flags |= item_flag3; // Sideview gravity flag | |
| 7783 | 20992 | } | |
| 7784 | |||
| 7785 |
2/2✓ Branch 0 taken 50176 times.
✓ Branch 1 taken 72192 times.
|
122368 | if( version < 0x254) //Nuke greyed-out flags/values from <=2.53, in case they are used in 2.54/2.55 |
| 7786 | { | ||
| 7787 |
60/60✓ Branch 0 taken 17547 times.
✓ Branch 1 taken 844 times.
✓ Branch 2 taken 831 times.
✓ Branch 3 taken 600 times.
✓ Branch 4 taken 327 times.
✓ Branch 5 taken 282 times.
✓ Branch 6 taken 558 times.
✓ Branch 7 taken 614 times.
✓ Branch 8 taken 297 times.
✓ Branch 9 taken 917 times.
✓ Branch 10 taken 892 times.
✓ Branch 11 taken 557 times.
✓ Branch 12 taken 858 times.
✓ Branch 13 taken 558 times.
✓ Branch 14 taken 279 times.
✓ Branch 15 taken 558 times.
✓ Branch 16 taken 295 times.
✓ Branch 17 taken 279 times.
✓ Branch 18 taken 846 times.
✓ Branch 19 taken 282 times.
✓ Branch 20 taken 285 times.
✓ Branch 21 taken 560 times.
✓ Branch 22 taken 255 times.
✓ Branch 23 taken 282 times.
✓ Branch 24 taken 279 times.
✓ Branch 25 taken 279 times.
✓ Branch 26 taken 279 times.
✓ Branch 27 taken 295 times.
✓ Branch 28 taken 281 times.
✓ Branch 29 taken 282 times.
✓ Branch 30 taken 279 times.
✓ Branch 31 taken 284 times.
✓ Branch 32 taken 558 times.
✓ Branch 33 taken 1116 times.
✓ Branch 34 taken 780 times.
✓ Branch 35 taken 279 times.
✓ Branch 36 taken 545 times.
✓ Branch 37 taken 1116 times.
✓ Branch 38 taken 279 times.
✓ Branch 39 taken 279 times.
✓ Branch 40 taken 279 times.
✓ Branch 41 taken 279 times.
✓ Branch 42 taken 279 times.
✓ Branch 43 taken 561 times.
✓ Branch 44 taken 558 times.
✓ Branch 45 taken 279 times.
✓ Branch 46 taken 840 times.
✓ Branch 47 taken 843 times.
✓ Branch 48 taken 1128 times.
✓ Branch 49 taken 279 times.
✓ Branch 50 taken 279 times.
✓ Branch 51 taken 279 times.
✓ Branch 52 taken 279 times.
✓ Branch 53 taken 279 times.
✓ Branch 54 taken 306 times.
✓ Branch 55 taken 10652 times.
✓ Branch 56 taken 2872 times.
✓ Branch 57 taken 842 times.
✓ Branch 58 taken 3261 times.
✓ Branch 59 taken 11005 times.
|
72192 | switch(tempitem.family) |
| 7788 | { | ||
| 7789 | case itype_sword: | ||
| 7790 | { | ||
| 7791 | 17547 | tempitem.flags &= ~(item_flag5); | |
| 7792 | 17547 | tempitem.misc3 = 0; | |
| 7793 | 17547 | tempitem.misc4 = 0; | |
| 7794 | 17547 | tempitem.misc5 = 0; | |
| 7795 | 17547 | tempitem.misc6 = 0; | |
| 7796 | 17547 | tempitem.misc7 = 0; | |
| 7797 | 17547 | tempitem.misc8 = 0; | |
| 7798 | 17547 | tempitem.misc9 = 0; | |
| 7799 | 17547 | tempitem.misc10 = 0; | |
| 7800 | 17547 | tempitem.wpn4 = 0; | |
| 7801 | 17547 | tempitem.wpn5 = 0; | |
| 7802 | 17547 | tempitem.wpn6 = 0; | |
| 7803 | 17547 | tempitem.wpn7 = 0; | |
| 7804 | 17547 | tempitem.wpn8 = 0; | |
| 7805 | 17547 | tempitem.wpn9 = 0; | |
| 7806 | 17547 | tempitem.wpn10 = 0; | |
| 7807 | 17547 | break; | |
| 7808 | } | ||
| 7809 | case itype_brang: | ||
| 7810 | { | ||
| 7811 | 844 | tempitem.flags &= ~(item_flag4 | item_flag5); | |
| 7812 | 844 | tempitem.misc2 = 0; | |
| 7813 | 844 | tempitem.misc5 = 0; | |
| 7814 | 844 | tempitem.misc6 = 0; | |
| 7815 | 844 | tempitem.misc7 = 0; | |
| 7816 | 844 | tempitem.misc8 = 0; | |
| 7817 | 844 | tempitem.misc9 = 0; | |
| 7818 | 844 | tempitem.misc10 = 0; | |
| 7819 | 844 | tempitem.wpn4 = 0; | |
| 7820 | 844 | tempitem.wpn5 = 0; | |
| 7821 | 844 | tempitem.wpn6 = 0; | |
| 7822 | 844 | tempitem.wpn7 = 0; | |
| 7823 | 844 | tempitem.wpn8 = 0; | |
| 7824 | 844 | tempitem.wpn9 = 0; | |
| 7825 | 844 | tempitem.wpn10 = 0; | |
| 7826 | 844 | break; | |
| 7827 | } | ||
| 7828 | case itype_arrow: | ||
| 7829 | { | ||
| 7830 | 831 | tempitem.flags &= ~ (item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 7831 | 831 | tempitem.misc2 = 0; | |
| 7832 | 831 | tempitem.misc3 = 0; | |
| 7833 | 831 | tempitem.misc4 = 0; | |
| 7834 | 831 | tempitem.misc5 = 0; | |
| 7835 | 831 | tempitem.misc6 = 0; | |
| 7836 | 831 | tempitem.misc7 = 0; | |
| 7837 | 831 | tempitem.misc8 = 0; | |
| 7838 | 831 | tempitem.misc9 = 0; | |
| 7839 | 831 | tempitem.misc10 = 0; | |
| 7840 | 831 | tempitem.wpn4 = 0; | |
| 7841 | 831 | tempitem.wpn5 = 0; | |
| 7842 | 831 | tempitem.wpn6 = 0; | |
| 7843 | 831 | tempitem.wpn7 = 0; | |
| 7844 | 831 | tempitem.wpn8 = 0; | |
| 7845 | 831 | tempitem.wpn9 = 0; | |
| 7846 | 831 | tempitem.wpn10 = 0; | |
| 7847 | 831 | break; | |
| 7848 | } | ||
| 7849 | case itype_candle: | ||
| 7850 | { | ||
| 7851 | 600 | tempitem.flags &= ~ (item_flag3 | item_flag5); | |
| 7852 | 600 | tempitem.misc1 = 0; | |
| 7853 | 600 | tempitem.misc2 = 0; | |
| 7854 | 600 | tempitem.misc3 = 0; | |
| 7855 | 600 | tempitem.misc4 = 0; | |
| 7856 | 600 | tempitem.misc5 = 0; | |
| 7857 | 600 | tempitem.misc6 = 0; | |
| 7858 | 600 | tempitem.misc7 = 0; | |
| 7859 | 600 | tempitem.misc8 = 0; | |
| 7860 | 600 | tempitem.misc9 = 0; | |
| 7861 | 600 | tempitem.misc10 = 0; | |
| 7862 | 600 | tempitem.wpn4 = 0; | |
| 7863 | 600 | tempitem.wpn5 = 0; | |
| 7864 | 600 | tempitem.wpn6 = 0; | |
| 7865 | 600 | tempitem.wpn7 = 0; | |
| 7866 | 600 | tempitem.wpn8 = 0; | |
| 7867 | 600 | tempitem.wpn9 = 0; | |
| 7868 | 600 | tempitem.wpn10 = 0; | |
| 7869 | 600 | break; | |
| 7870 | } | ||
| 7871 | case itype_whistle: | ||
| 7872 | { | ||
| 7873 | 327 | tempitem.flags &= ~ (item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 7874 | 327 | tempitem.misc3 = 0; | |
| 7875 | 327 | tempitem.misc4 = 0; | |
| 7876 | 327 | tempitem.misc5 = 0; | |
| 7877 | 327 | tempitem.misc6 = 0; | |
| 7878 | 327 | tempitem.misc7 = 0; | |
| 7879 | 327 | tempitem.misc8 = 0; | |
| 7880 | 327 | tempitem.misc9 = 0; | |
| 7881 | 327 | tempitem.misc10 = 0; | |
| 7882 | 327 | tempitem.wpn2 = 0; | |
| 7883 | 327 | tempitem.wpn3 = 0; | |
| 7884 | 327 | tempitem.wpn4 = 0; | |
| 7885 | 327 | tempitem.wpn5 = 0; | |
| 7886 | 327 | tempitem.wpn6 = 0; | |
| 7887 | 327 | tempitem.wpn7 = 0; | |
| 7888 | 327 | tempitem.wpn8 = 0; | |
| 7889 | 327 | tempitem.wpn9 = 0; | |
| 7890 | 327 | tempitem.wpn10 = 0; | |
| 7891 | 327 | break; | |
| 7892 | } | ||
| 7893 | case itype_bait: | ||
| 7894 | { | ||
| 7895 | 282 | tempitem.flags &= ~ (item_flag1 | item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 7896 | 282 | tempitem.misc2 = 0; | |
| 7897 | 282 | tempitem.misc3 = 0; | |
| 7898 | 282 | tempitem.misc4 = 0; | |
| 7899 | 282 | tempitem.misc5 = 0; | |
| 7900 | 282 | tempitem.misc6 = 0; | |
| 7901 | 282 | tempitem.misc7 = 0; | |
| 7902 | 282 | tempitem.misc8 = 0; | |
| 7903 | 282 | tempitem.misc9 = 0; | |
| 7904 | 282 | tempitem.misc10 = 0; | |
| 7905 | 282 | tempitem.wpn2 = 0; | |
| 7906 | 282 | tempitem.wpn3 = 0; | |
| 7907 | 282 | tempitem.wpn4 = 0; | |
| 7908 | 282 | tempitem.wpn5 = 0; | |
| 7909 | 282 | tempitem.wpn6 = 0; | |
| 7910 | 282 | tempitem.wpn7 = 0; | |
| 7911 | 282 | tempitem.wpn8 = 0; | |
| 7912 | 282 | tempitem.wpn9 = 0; | |
| 7913 | 282 | tempitem.wpn10 = 0; | |
| 7914 | 282 | break; | |
| 7915 | } | ||
| 7916 | case itype_letter: | ||
| 7917 | { | ||
| 7918 | 558 | tempitem.flags &= ~ (item_flag1 | item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 7919 | 558 | tempitem.misc1 = 0; | |
| 7920 | 558 | tempitem.misc2 = 0; | |
| 7921 | 558 | tempitem.misc3 = 0; | |
| 7922 | 558 | tempitem.misc4 = 0; | |
| 7923 | 558 | tempitem.misc5 = 0; | |
| 7924 | 558 | tempitem.misc6 = 0; | |
| 7925 | 558 | tempitem.misc7 = 0; | |
| 7926 | 558 | tempitem.misc8 = 0; | |
| 7927 | 558 | tempitem.misc9 = 0; | |
| 7928 | 558 | tempitem.misc10 = 0; | |
| 7929 | 558 | tempitem.wpn = 0; | |
| 7930 | 558 | tempitem.wpn2 = 0; | |
| 7931 | 558 | tempitem.wpn3 = 0; | |
| 7932 | 558 | tempitem.wpn4 = 0; | |
| 7933 | 558 | tempitem.wpn5 = 0; | |
| 7934 | 558 | tempitem.wpn6 = 0; | |
| 7935 | 558 | tempitem.wpn7 = 0; | |
| 7936 | 558 | tempitem.wpn8 = 0; | |
| 7937 | 558 | tempitem.wpn9 = 0; | |
| 7938 | 558 | tempitem.wpn10 = 0; | |
| 7939 | 558 | break; | |
| 7940 | } | ||
| 7941 | case itype_potion: | ||
| 7942 | { | ||
| 7943 | 614 | tempitem.flags &= ~ (item_flag3 | item_flag4 | item_flag5); | |
| 7944 | 614 | tempitem.misc3 = 0; | |
| 7945 | 614 | tempitem.misc4 = 0; | |
| 7946 | 614 | tempitem.misc5 = 0; | |
| 7947 | 614 | tempitem.misc6 = 0; | |
| 7948 | 614 | tempitem.misc7 = 0; | |
| 7949 | 614 | tempitem.misc8 = 0; | |
| 7950 | 614 | tempitem.misc9 = 0; | |
| 7951 | 614 | tempitem.misc10 = 0; | |
| 7952 | 614 | tempitem.wpn = 0; | |
| 7953 | 614 | tempitem.wpn2 = 0; | |
| 7954 | 614 | tempitem.wpn3 = 0; | |
| 7955 | 614 | tempitem.wpn4 = 0; | |
| 7956 | 614 | tempitem.wpn5 = 0; | |
| 7957 | 614 | tempitem.wpn6 = 0; | |
| 7958 | 614 | tempitem.wpn7 = 0; | |
| 7959 | 614 | tempitem.wpn8 = 0; | |
| 7960 | 614 | tempitem.wpn9 = 0; | |
| 7961 | 614 | tempitem.wpn10 = 0; | |
| 7962 | 614 | break; | |
| 7963 | } | ||
| 7964 | case itype_wand: | ||
| 7965 | { | ||
| 7966 | 297 | tempitem.flags &= ~ (item_flag2 | item_flag3 | item_flag5); | |
| 7967 | 297 | tempitem.misc1 = 0; | |
| 7968 | 297 | tempitem.misc2 = 0; | |
| 7969 | 297 | tempitem.misc3 = 0; | |
| 7970 | 297 | tempitem.misc4 = 0; | |
| 7971 | 297 | tempitem.misc5 = 0; | |
| 7972 | 297 | tempitem.misc6 = 0; | |
| 7973 | 297 | tempitem.misc7 = 0; | |
| 7974 | 297 | tempitem.misc8 = 0; | |
| 7975 | 297 | tempitem.misc9 = 0; | |
| 7976 | 297 | tempitem.misc10 = 0; | |
| 7977 | 297 | tempitem.wpn4 = 0; | |
| 7978 | 297 | tempitem.wpn5 = 0; | |
| 7979 | 297 | tempitem.wpn6 = 0; | |
| 7980 | 297 | tempitem.wpn7 = 0; | |
| 7981 | 297 | tempitem.wpn8 = 0; | |
| 7982 | 297 | tempitem.wpn9 = 0; | |
| 7983 | 297 | tempitem.wpn10 = 0; | |
| 7984 | 297 | break; | |
| 7985 | } | ||
| 7986 | case itype_ring: | ||
| 7987 | { | ||
| 7988 | 917 | tempitem.flags &= ~ (item_flag1 | item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 7989 | 917 | tempitem.misc2 = 0; | |
| 7990 | 917 | tempitem.misc3 = 0; | |
| 7991 | 917 | tempitem.misc4 = 0; | |
| 7992 | 917 | tempitem.misc5 = 0; | |
| 7993 | 917 | tempitem.misc6 = 0; | |
| 7994 | 917 | tempitem.misc7 = 0; | |
| 7995 | 917 | tempitem.misc8 = 0; | |
| 7996 | 917 | tempitem.misc9 = 0; | |
| 7997 | 917 | tempitem.misc10 = 0; | |
| 7998 | 917 | tempitem.wpn = 0; | |
| 7999 | 917 | tempitem.wpn2 = 0; | |
| 8000 | 917 | tempitem.wpn3 = 0; | |
| 8001 | 917 | tempitem.wpn4 = 0; | |
| 8002 | 917 | tempitem.wpn5 = 0; | |
| 8003 | 917 | tempitem.wpn6 = 0; | |
| 8004 | 917 | tempitem.wpn7 = 0; | |
| 8005 | 917 | tempitem.wpn8 = 0; | |
| 8006 | 917 | tempitem.wpn9 = 0; | |
| 8007 | 917 | tempitem.wpn10 = 0; | |
| 8008 | 917 | break; | |
| 8009 | } | ||
| 8010 | case itype_wallet: | ||
| 8011 | { | ||
| 8012 | 892 | tempitem.flags &= ~ (item_flag1 | item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 8013 | 892 | tempitem.misc3 = 0; | |
| 8014 | 892 | tempitem.misc4 = 0; | |
| 8015 | 892 | tempitem.misc5 = 0; | |
| 8016 | 892 | tempitem.misc6 = 0; | |
| 8017 | 892 | tempitem.misc7 = 0; | |
| 8018 | 892 | tempitem.misc8 = 0; | |
| 8019 | 892 | tempitem.misc9 = 0; | |
| 8020 | 892 | tempitem.misc10 = 0; | |
| 8021 | 892 | tempitem.wpn = 0; | |
| 8022 | 892 | tempitem.wpn2 = 0; | |
| 8023 | 892 | tempitem.wpn3 = 0; | |
| 8024 | 892 | tempitem.wpn4 = 0; | |
| 8025 | 892 | tempitem.wpn5 = 0; | |
| 8026 | 892 | tempitem.wpn6 = 0; | |
| 8027 | 892 | tempitem.wpn7 = 0; | |
| 8028 | 892 | tempitem.wpn8 = 0; | |
| 8029 | 892 | tempitem.wpn9 = 0; | |
| 8030 | 892 | tempitem.wpn10 = 0; | |
| 8031 | 892 | break; | |
| 8032 | } | ||
| 8033 | case itype_amulet: | ||
| 8034 | { | ||
| 8035 | 557 | tempitem.flags &= ~ (item_flag1 | item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 8036 | 557 | tempitem.misc1 = 0; | |
| 8037 | 557 | tempitem.misc2 = 0; | |
| 8038 | 557 | tempitem.misc3 = 0; | |
| 8039 | 557 | tempitem.misc4 = 0; | |
| 8040 | 557 | tempitem.misc5 = 0; | |
| 8041 | 557 | tempitem.misc6 = 0; | |
| 8042 | 557 | tempitem.misc7 = 0; | |
| 8043 | 557 | tempitem.misc8 = 0; | |
| 8044 | 557 | tempitem.misc9 = 0; | |
| 8045 | 557 | tempitem.misc10 = 0; | |
| 8046 | 557 | tempitem.wpn = 0; | |
| 8047 | 557 | tempitem.wpn2 = 0; | |
| 8048 | 557 | tempitem.wpn3 = 0; | |
| 8049 | 557 | tempitem.wpn4 = 0; | |
| 8050 | 557 | tempitem.wpn5 = 0; | |
| 8051 | 557 | tempitem.wpn6 = 0; | |
| 8052 | 557 | tempitem.wpn7 = 0; | |
| 8053 | 557 | tempitem.wpn8 = 0; | |
| 8054 | 557 | tempitem.wpn9 = 0; | |
| 8055 | 557 | tempitem.wpn10 = 0; | |
| 8056 | 557 | break; | |
| 8057 | } | ||
| 8058 | case itype_shield: | ||
| 8059 | { | ||
| 8060 | 858 | tempitem.flags &= ~ (item_flag1 | item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 8061 | 858 | tempitem.misc3 = 0; | |
| 8062 | 858 | tempitem.misc4 = 0; | |
| 8063 | 858 | tempitem.misc5 = 0; | |
| 8064 | 858 | tempitem.misc6 = 0; | |
| 8065 | 858 | tempitem.misc7 = 0; | |
| 8066 | 858 | tempitem.misc8 = 0; | |
| 8067 | 858 | tempitem.misc9 = 0; | |
| 8068 | 858 | tempitem.misc10 = 0; | |
| 8069 | 858 | tempitem.wpn = 0; | |
| 8070 | 858 | tempitem.wpn2 = 0; | |
| 8071 | 858 | tempitem.wpn3 = 0; | |
| 8072 | 858 | tempitem.wpn4 = 0; | |
| 8073 | 858 | tempitem.wpn5 = 0; | |
| 8074 | 858 | tempitem.wpn6 = 0; | |
| 8075 | 858 | tempitem.wpn7 = 0; | |
| 8076 | 858 | tempitem.wpn8 = 0; | |
| 8077 | 858 | tempitem.wpn9 = 0; | |
| 8078 | 858 | tempitem.wpn10 = 0; | |
| 8079 | 858 | break; | |
| 8080 | } | ||
| 8081 | case itype_bow: | ||
| 8082 | { | ||
| 8083 | 558 | tempitem.flags &= ~ (item_flag1 | item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 8084 | 558 | tempitem.misc1 = 0; | |
| 8085 | 558 | tempitem.misc2 = 0; | |
| 8086 | 558 | tempitem.misc3 = 0; | |
| 8087 | 558 | tempitem.misc4 = 0; | |
| 8088 | 558 | tempitem.misc5 = 0; | |
| 8089 | 558 | tempitem.misc6 = 0; | |
| 8090 | 558 | tempitem.misc7 = 0; | |
| 8091 | 558 | tempitem.misc8 = 0; | |
| 8092 | 558 | tempitem.misc9 = 0; | |
| 8093 | 558 | tempitem.misc10 = 0; | |
| 8094 | 558 | tempitem.wpn = 0; | |
| 8095 | 558 | tempitem.wpn2 = 0; | |
| 8096 | 558 | tempitem.wpn3 = 0; | |
| 8097 | 558 | tempitem.wpn4 = 0; | |
| 8098 | 558 | tempitem.wpn5 = 0; | |
| 8099 | 558 | tempitem.wpn6 = 0; | |
| 8100 | 558 | tempitem.wpn7 = 0; | |
| 8101 | 558 | tempitem.wpn8 = 0; | |
| 8102 | 558 | tempitem.wpn9 = 0; | |
| 8103 | 558 | tempitem.wpn10 = 0; | |
| 8104 | 558 | break; | |
| 8105 | } | ||
| 8106 | case itype_raft: | ||
| 8107 | { | ||
| 8108 | 279 | tempitem.flags &= ~ (item_flag1 | item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 8109 | 279 | tempitem.misc1 = 0; | |
| 8110 | 279 | tempitem.misc2 = 0; | |
| 8111 | 279 | tempitem.misc3 = 0; | |
| 8112 | 279 | tempitem.misc4 = 0; | |
| 8113 | 279 | tempitem.misc5 = 0; | |
| 8114 | 279 | tempitem.misc6 = 0; | |
| 8115 | 279 | tempitem.misc7 = 0; | |
| 8116 | 279 | tempitem.misc8 = 0; | |
| 8117 | 279 | tempitem.misc9 = 0; | |
| 8118 | 279 | tempitem.misc10 = 0; | |
| 8119 | 279 | tempitem.wpn = 0; | |
| 8120 | 279 | tempitem.wpn2 = 0; | |
| 8121 | 279 | tempitem.wpn3 = 0; | |
| 8122 | 279 | tempitem.wpn4 = 0; | |
| 8123 | 279 | tempitem.wpn5 = 0; | |
| 8124 | 279 | tempitem.wpn6 = 0; | |
| 8125 | 279 | tempitem.wpn7 = 0; | |
| 8126 | 279 | tempitem.wpn8 = 0; | |
| 8127 | 279 | tempitem.wpn9 = 0; | |
| 8128 | 279 | tempitem.wpn10 = 0; | |
| 8129 | 279 | break; | |
| 8130 | } | ||
| 8131 | case itype_ladder: | ||
| 8132 | { | ||
| 8133 | 558 | tempitem.flags &= ~ (item_flag1 | item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 8134 | 558 | tempitem.misc1 = 0; | |
| 8135 | 558 | tempitem.misc2 = 0; | |
| 8136 | 558 | tempitem.misc3 = 0; | |
| 8137 | 558 | tempitem.misc4 = 0; | |
| 8138 | 558 | tempitem.misc5 = 0; | |
| 8139 | 558 | tempitem.misc6 = 0; | |
| 8140 | 558 | tempitem.misc7 = 0; | |
| 8141 | 558 | tempitem.misc8 = 0; | |
| 8142 | 558 | tempitem.misc9 = 0; | |
| 8143 | 558 | tempitem.misc10 = 0; | |
| 8144 | 558 | tempitem.wpn = 0; | |
| 8145 | 558 | tempitem.wpn2 = 0; | |
| 8146 | 558 | tempitem.wpn3 = 0; | |
| 8147 | 558 | tempitem.wpn4 = 0; | |
| 8148 | 558 | tempitem.wpn5 = 0; | |
| 8149 | 558 | tempitem.wpn6 = 0; | |
| 8150 | 558 | tempitem.wpn7 = 0; | |
| 8151 | 558 | tempitem.wpn8 = 0; | |
| 8152 | 558 | tempitem.wpn9 = 0; | |
| 8153 | 558 | tempitem.wpn10 = 0; | |
| 8154 | 558 | break; | |
| 8155 | } | ||
| 8156 | case itype_book: | ||
| 8157 | { | ||
| 8158 | 295 | tempitem.flags &= ~ (item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 8159 | 295 | tempitem.misc1 = 0; | |
| 8160 | 295 | tempitem.misc2 = 0; | |
| 8161 | 295 | tempitem.misc3 = 0; | |
| 8162 | 295 | tempitem.misc4 = 0; | |
| 8163 | 295 | tempitem.misc5 = 0; | |
| 8164 | 295 | tempitem.misc6 = 0; | |
| 8165 | 295 | tempitem.misc7 = 0; | |
| 8166 | 295 | tempitem.misc8 = 0; | |
| 8167 | 295 | tempitem.misc9 = 0; | |
| 8168 | 295 | tempitem.misc10 = 0; | |
| 8169 | 295 | tempitem.wpn3 = 0; | |
| 8170 | 295 | tempitem.wpn4 = 0; | |
| 8171 | 295 | tempitem.wpn5 = 0; | |
| 8172 | 295 | tempitem.wpn6 = 0; | |
| 8173 | 295 | tempitem.wpn7 = 0; | |
| 8174 | 295 | tempitem.wpn8 = 0; | |
| 8175 | 295 | tempitem.wpn9 = 0; | |
| 8176 | 295 | tempitem.wpn10 = 0; | |
| 8177 | 295 | break; | |
| 8178 | } | ||
| 8179 | case itype_magickey: | ||
| 8180 | { | ||
| 8181 | 279 | tempitem.flags &= ~ (item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 8182 | 279 | tempitem.misc1 = 0; | |
| 8183 | 279 | tempitem.misc2 = 0; | |
| 8184 | 279 | tempitem.misc3 = 0; | |
| 8185 | 279 | tempitem.misc4 = 0; | |
| 8186 | 279 | tempitem.misc5 = 0; | |
| 8187 | 279 | tempitem.misc6 = 0; | |
| 8188 | 279 | tempitem.misc7 = 0; | |
| 8189 | 279 | tempitem.misc8 = 0; | |
| 8190 | 279 | tempitem.misc9 = 0; | |
| 8191 | 279 | tempitem.misc10 = 0; | |
| 8192 | 279 | tempitem.wpn = 0; | |
| 8193 | 279 | tempitem.wpn2 = 0; | |
| 8194 | 279 | tempitem.wpn3 = 0; | |
| 8195 | 279 | tempitem.wpn4 = 0; | |
| 8196 | 279 | tempitem.wpn5 = 0; | |
| 8197 | 279 | tempitem.wpn6 = 0; | |
| 8198 | 279 | tempitem.wpn7 = 0; | |
| 8199 | 279 | tempitem.wpn8 = 0; | |
| 8200 | 279 | tempitem.wpn9 = 0; | |
| 8201 | 279 | tempitem.wpn10 = 0; | |
| 8202 | 279 | break; | |
| 8203 | } | ||
| 8204 | case itype_bracelet: | ||
| 8205 | { | ||
| 8206 | 846 | tempitem.flags &= ~ (item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 8207 | 846 | tempitem.misc1 = 0; | |
| 8208 | 846 | tempitem.misc2 = 0; | |
| 8209 | 846 | tempitem.misc3 = 0; | |
| 8210 | 846 | tempitem.misc4 = 0; | |
| 8211 | 846 | tempitem.misc5 = 0; | |
| 8212 | 846 | tempitem.misc6 = 0; | |
| 8213 | 846 | tempitem.misc7 = 0; | |
| 8214 | 846 | tempitem.misc8 = 0; | |
| 8215 | 846 | tempitem.misc9 = 0; | |
| 8216 | 846 | tempitem.misc10 = 0; | |
| 8217 | 846 | tempitem.wpn = 0; | |
| 8218 | 846 | tempitem.wpn2 = 0; | |
| 8219 | 846 | tempitem.wpn3 = 0; | |
| 8220 | 846 | tempitem.wpn4 = 0; | |
| 8221 | 846 | tempitem.wpn5 = 0; | |
| 8222 | 846 | tempitem.wpn6 = 0; | |
| 8223 | 846 | tempitem.wpn7 = 0; | |
| 8224 | 846 | tempitem.wpn8 = 0; | |
| 8225 | 846 | tempitem.wpn9 = 0; | |
| 8226 | 846 | tempitem.wpn10 = 0; | |
| 8227 | 846 | break; | |
| 8228 | } | ||
| 8229 | case itype_flippers: | ||
| 8230 | { | ||
| 8231 | 282 | tempitem.flags &= ~ (item_flag1 | item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 8232 | 282 | tempitem.misc1 = 0; | |
| 8233 | 282 | tempitem.misc2 = 0; | |
| 8234 | 282 | tempitem.misc3 = 0; | |
| 8235 | 282 | tempitem.misc4 = 0; | |
| 8236 | 282 | tempitem.misc5 = 0; | |
| 8237 | 282 | tempitem.misc6 = 0; | |
| 8238 | 282 | tempitem.misc7 = 0; | |
| 8239 | 282 | tempitem.misc8 = 0; | |
| 8240 | 282 | tempitem.misc9 = 0; | |
| 8241 | 282 | tempitem.misc10 = 0; | |
| 8242 | 282 | tempitem.wpn = 0; | |
| 8243 | 282 | tempitem.wpn2 = 0; | |
| 8244 | 282 | tempitem.wpn3 = 0; | |
| 8245 | 282 | tempitem.wpn4 = 0; | |
| 8246 | 282 | tempitem.wpn5 = 0; | |
| 8247 | 282 | tempitem.wpn6 = 0; | |
| 8248 | 282 | tempitem.wpn7 = 0; | |
| 8249 | 282 | tempitem.wpn8 = 0; | |
| 8250 | 282 | tempitem.wpn9 = 0; | |
| 8251 | 282 | tempitem.wpn10 = 0; | |
| 8252 | 282 | break; | |
| 8253 | } | ||
| 8254 | case itype_boots: | ||
| 8255 | { | ||
| 8256 | 285 | tempitem.flags &= ~ (item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 8257 | 285 | tempitem.misc1 = 0; | |
| 8258 | 285 | tempitem.misc2 = 0; | |
| 8259 | 285 | tempitem.misc3 = 0; | |
| 8260 | 285 | tempitem.misc4 = 0; | |
| 8261 | 285 | tempitem.misc5 = 0; | |
| 8262 | 285 | tempitem.misc6 = 0; | |
| 8263 | 285 | tempitem.misc7 = 0; | |
| 8264 | 285 | tempitem.misc8 = 0; | |
| 8265 | 285 | tempitem.misc9 = 0; | |
| 8266 | 285 | tempitem.misc10 = 0; | |
| 8267 | 285 | tempitem.wpn = 0; | |
| 8268 | 285 | tempitem.wpn2 = 0; | |
| 8269 | 285 | tempitem.wpn3 = 0; | |
| 8270 | 285 | tempitem.wpn4 = 0; | |
| 8271 | 285 | tempitem.wpn5 = 0; | |
| 8272 | 285 | tempitem.wpn6 = 0; | |
| 8273 | 285 | tempitem.wpn7 = 0; | |
| 8274 | 285 | tempitem.wpn8 = 0; | |
| 8275 | 285 | tempitem.wpn9 = 0; | |
| 8276 | 285 | tempitem.wpn10 = 0; | |
| 8277 | 285 | break; | |
| 8278 | } | ||
| 8279 | case itype_hookshot: | ||
| 8280 | { | ||
| 8281 | 560 | tempitem.flags &= ~ (item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 8282 | 560 | tempitem.misc5 = 0; | |
| 8283 | 560 | tempitem.misc6 = 0; | |
| 8284 | 560 | tempitem.misc7 = 0; | |
| 8285 | 560 | tempitem.misc8 = 0; | |
| 8286 | 560 | tempitem.misc9 = 0; | |
| 8287 | 560 | tempitem.misc10 = 0; | |
| 8288 | 560 | tempitem.wpn5 = 0; | |
| 8289 | 560 | tempitem.wpn6 = 0; | |
| 8290 | 560 | tempitem.wpn7 = 0; | |
| 8291 | 560 | tempitem.wpn8 = 0; | |
| 8292 | 560 | tempitem.wpn9 = 0; | |
| 8293 | 560 | tempitem.wpn10 = 0; | |
| 8294 | 560 | break; | |
| 8295 | } | ||
| 8296 | case itype_lens: | ||
| 8297 | { | ||
| 8298 | 255 | tempitem.flags &= ~ (item_flag1 | item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 8299 | 255 | tempitem.misc2 = 0; | |
| 8300 | 255 | tempitem.misc3 = 0; | |
| 8301 | 255 | tempitem.misc4 = 0; | |
| 8302 | 255 | tempitem.misc5 = 0; | |
| 8303 | 255 | tempitem.misc6 = 0; | |
| 8304 | 255 | tempitem.misc7 = 0; | |
| 8305 | 255 | tempitem.misc8 = 0; | |
| 8306 | 255 | tempitem.misc9 = 0; | |
| 8307 | 255 | tempitem.misc10 = 0; | |
| 8308 | 255 | tempitem.wpn = 0; | |
| 8309 | 255 | tempitem.wpn2 = 0; | |
| 8310 | 255 | tempitem.wpn3 = 0; | |
| 8311 | 255 | tempitem.wpn4 = 0; | |
| 8312 | 255 | tempitem.wpn5 = 0; | |
| 8313 | 255 | tempitem.wpn6 = 0; | |
| 8314 | 255 | tempitem.wpn7 = 0; | |
| 8315 | 255 | tempitem.wpn8 = 0; | |
| 8316 | 255 | tempitem.wpn9 = 0; | |
| 8317 | 255 | tempitem.wpn10 = 0; | |
| 8318 | 255 | break; | |
| 8319 | } | ||
| 8320 | case itype_hammer: | ||
| 8321 | { | ||
| 8322 | 282 | tempitem.flags &= ~ (item_flag1 | item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 8323 | 282 | tempitem.misc1 = 0; | |
| 8324 | 282 | tempitem.misc2 = 0; | |
| 8325 | 282 | tempitem.misc3 = 0; | |
| 8326 | 282 | tempitem.misc4 = 0; | |
| 8327 | 282 | tempitem.misc5 = 0; | |
| 8328 | 282 | tempitem.misc6 = 0; | |
| 8329 | 282 | tempitem.misc7 = 0; | |
| 8330 | 282 | tempitem.misc8 = 0; | |
| 8331 | 282 | tempitem.misc9 = 0; | |
| 8332 | 282 | tempitem.misc10 = 0; | |
| 8333 | 282 | tempitem.wpn3 = 0; | |
| 8334 | 282 | tempitem.wpn4 = 0; | |
| 8335 | 282 | tempitem.wpn5 = 0; | |
| 8336 | 282 | tempitem.wpn6 = 0; | |
| 8337 | 282 | tempitem.wpn7 = 0; | |
| 8338 | 282 | tempitem.wpn8 = 0; | |
| 8339 | 282 | tempitem.wpn9 = 0; | |
| 8340 | 282 | tempitem.wpn10 = 0; | |
| 8341 | 282 | break; | |
| 8342 | } | ||
| 8343 | case itype_divinefire: | ||
| 8344 | { | ||
| 8345 | 279 | tempitem.flags &= ~ (item_flag1 | item_flag4 | item_flag5); | |
| 8346 | 279 | tempitem.misc3 = 0; | |
| 8347 | 279 | tempitem.misc4 = 0; | |
| 8348 | 279 | tempitem.misc5 = 0; | |
| 8349 | 279 | tempitem.misc6 = 0; | |
| 8350 | 279 | tempitem.misc7 = 0; | |
| 8351 | 279 | tempitem.misc8 = 0; | |
| 8352 | 279 | tempitem.misc9 = 0; | |
| 8353 | 279 | tempitem.misc10 = 0; | |
| 8354 | 279 | tempitem.wpn6 = 0; | |
| 8355 | 279 | tempitem.wpn7 = 0; | |
| 8356 | 279 | tempitem.wpn8 = 0; | |
| 8357 | 279 | tempitem.wpn9 = 0; | |
| 8358 | 279 | tempitem.wpn10 = 0; | |
| 8359 | 279 | break; | |
| 8360 | } | ||
| 8361 | case itype_divineescape: | ||
| 8362 | { | ||
| 8363 | 279 | tempitem.flags &= ~ (item_flag1 | item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 8364 | 279 | tempitem.misc2 = 0; | |
| 8365 | 279 | tempitem.misc3 = 0; | |
| 8366 | 279 | tempitem.misc4 = 0; | |
| 8367 | 279 | tempitem.misc5 = 0; | |
| 8368 | 279 | tempitem.misc6 = 0; | |
| 8369 | 279 | tempitem.misc7 = 0; | |
| 8370 | 279 | tempitem.misc8 = 0; | |
| 8371 | 279 | tempitem.misc9 = 0; | |
| 8372 | 279 | tempitem.misc10 = 0; | |
| 8373 | 279 | tempitem.wpn = 0; | |
| 8374 | 279 | tempitem.wpn2 = 0; | |
| 8375 | 279 | tempitem.wpn3 = 0; | |
| 8376 | 279 | tempitem.wpn4 = 0; | |
| 8377 | 279 | tempitem.wpn5 = 0; | |
| 8378 | 279 | tempitem.wpn6 = 0; | |
| 8379 | 279 | tempitem.wpn7 = 0; | |
| 8380 | 279 | tempitem.wpn8 = 0; | |
| 8381 | 279 | tempitem.wpn9 = 0; | |
| 8382 | 279 | tempitem.wpn10 = 0; | |
| 8383 | 279 | break; | |
| 8384 | } | ||
| 8385 | case itype_divineprotection: | ||
| 8386 | { | ||
| 8387 | 279 | tempitem.flags &= ~ (item_flag5); | |
| 8388 | 279 | tempitem.misc2 = 0; | |
| 8389 | 279 | tempitem.misc3 = 0; | |
| 8390 | 279 | tempitem.misc4 = 0; | |
| 8391 | 279 | tempitem.misc5 = 0; | |
| 8392 | 279 | tempitem.misc6 = 0; | |
| 8393 | 279 | tempitem.misc7 = 0; | |
| 8394 | 279 | tempitem.misc8 = 0; | |
| 8395 | 279 | tempitem.misc9 = 0; | |
| 8396 | 279 | tempitem.misc10 = 0; | |
| 8397 | 279 | break; | |
| 8398 | } | ||
| 8399 | case itype_bomb: | ||
| 8400 | { | ||
| 8401 | 295 | tempitem.flags &= ~ (item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 8402 | 295 | tempitem.misc4 = 0; | |
| 8403 | 295 | tempitem.misc5 = 0; | |
| 8404 | 295 | tempitem.misc6 = 0; | |
| 8405 | 295 | tempitem.misc7 = 0; | |
| 8406 | 295 | tempitem.misc8 = 0; | |
| 8407 | 295 | tempitem.misc9 = 0; | |
| 8408 | 295 | tempitem.misc10 = 0; | |
| 8409 | 295 | tempitem.wpn3 = 0; | |
| 8410 | 295 | tempitem.wpn4 = 0; | |
| 8411 | 295 | tempitem.wpn5 = 0; | |
| 8412 | 295 | tempitem.wpn6 = 0; | |
| 8413 | 295 | tempitem.wpn7 = 0; | |
| 8414 | 295 | tempitem.wpn8 = 0; | |
| 8415 | 295 | tempitem.wpn9 = 0; | |
| 8416 | 295 | tempitem.wpn10 = 0; | |
| 8417 | 295 | break; | |
| 8418 | } | ||
| 8419 | case itype_sbomb: | ||
| 8420 | { | ||
| 8421 | 281 | tempitem.flags &= ~ (item_flag1 | item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 8422 | 281 | tempitem.misc4 = 0; | |
| 8423 | 281 | tempitem.misc5 = 0; | |
| 8424 | 281 | tempitem.misc6 = 0; | |
| 8425 | 281 | tempitem.misc7 = 0; | |
| 8426 | 281 | tempitem.misc8 = 0; | |
| 8427 | 281 | tempitem.misc9 = 0; | |
| 8428 | 281 | tempitem.misc10 = 0; | |
| 8429 | 281 | tempitem.wpn3 = 0; | |
| 8430 | 281 | tempitem.wpn4 = 0; | |
| 8431 | 281 | tempitem.wpn5 = 0; | |
| 8432 | 281 | tempitem.wpn6 = 0; | |
| 8433 | 281 | tempitem.wpn7 = 0; | |
| 8434 | 281 | tempitem.wpn8 = 0; | |
| 8435 | 281 | tempitem.wpn9 = 0; | |
| 8436 | 281 | tempitem.wpn10 = 0; | |
| 8437 | 281 | break; | |
| 8438 | } | ||
| 8439 | case itype_clock: | ||
| 8440 | { | ||
| 8441 | 282 | tempitem.flags &= ~ (item_flag1 | item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 8442 | 282 | tempitem.misc2 = 0; | |
| 8443 | 282 | tempitem.misc3 = 0; | |
| 8444 | 282 | tempitem.misc4 = 0; | |
| 8445 | 282 | tempitem.misc5 = 0; | |
| 8446 | 282 | tempitem.misc6 = 0; | |
| 8447 | 282 | tempitem.misc7 = 0; | |
| 8448 | 282 | tempitem.misc8 = 0; | |
| 8449 | 282 | tempitem.misc9 = 0; | |
| 8450 | 282 | tempitem.misc10 = 0; | |
| 8451 | 282 | tempitem.wpn = 0; | |
| 8452 | 282 | tempitem.wpn2 = 0; | |
| 8453 | 282 | tempitem.wpn3 = 0; | |
| 8454 | 282 | tempitem.wpn4 = 0; | |
| 8455 | 282 | tempitem.wpn5 = 0; | |
| 8456 | 282 | tempitem.wpn6 = 0; | |
| 8457 | 282 | tempitem.wpn7 = 0; | |
| 8458 | 282 | tempitem.wpn8 = 0; | |
| 8459 | 282 | tempitem.wpn9 = 0; | |
| 8460 | 282 | tempitem.wpn10 = 0; | |
| 8461 | 282 | break; | |
| 8462 | } | ||
| 8463 | case itype_key: | ||
| 8464 | { | ||
| 8465 | 279 | tempitem.flags &= ~ (item_flag1 | item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 8466 | 279 | tempitem.misc1 = 0; | |
| 8467 | 279 | tempitem.misc2 = 0; | |
| 8468 | 279 | tempitem.misc3 = 0; | |
| 8469 | 279 | tempitem.misc4 = 0; | |
| 8470 | 279 | tempitem.misc5 = 0; | |
| 8471 | 279 | tempitem.misc6 = 0; | |
| 8472 | 279 | tempitem.misc7 = 0; | |
| 8473 | 279 | tempitem.misc8 = 0; | |
| 8474 | 279 | tempitem.misc9 = 0; | |
| 8475 | 279 | tempitem.misc10 = 0; | |
| 8476 | 279 | tempitem.wpn = 0; | |
| 8477 | 279 | tempitem.wpn2 = 0; | |
| 8478 | 279 | tempitem.wpn3 = 0; | |
| 8479 | 279 | tempitem.wpn4 = 0; | |
| 8480 | 279 | tempitem.wpn5 = 0; | |
| 8481 | 279 | tempitem.wpn6 = 0; | |
| 8482 | 279 | tempitem.wpn7 = 0; | |
| 8483 | 279 | tempitem.wpn8 = 0; | |
| 8484 | 279 | tempitem.wpn9 = 0; | |
| 8485 | 279 | tempitem.wpn10 = 0; | |
| 8486 | 279 | break; | |
| 8487 | } | ||
| 8488 | case itype_magiccontainer: | ||
| 8489 | { | ||
| 8490 | 284 | tempitem.flags &= ~ (item_flag1 | item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 8491 | 284 | tempitem.misc1 = 0; | |
| 8492 | 284 | tempitem.misc2 = 0; | |
| 8493 | 284 | tempitem.misc3 = 0; | |
| 8494 | 284 | tempitem.misc4 = 0; | |
| 8495 | 284 | tempitem.misc5 = 0; | |
| 8496 | 284 | tempitem.misc6 = 0; | |
| 8497 | 284 | tempitem.misc7 = 0; | |
| 8498 | 284 | tempitem.misc8 = 0; | |
| 8499 | 284 | tempitem.misc9 = 0; | |
| 8500 | 284 | tempitem.misc10 = 0; | |
| 8501 | 284 | tempitem.wpn = 0; | |
| 8502 | 284 | tempitem.wpn2 = 0; | |
| 8503 | 284 | tempitem.wpn3 = 0; | |
| 8504 | 284 | tempitem.wpn4 = 0; | |
| 8505 | 284 | tempitem.wpn5 = 0; | |
| 8506 | 284 | tempitem.wpn6 = 0; | |
| 8507 | 284 | tempitem.wpn7 = 0; | |
| 8508 | 284 | tempitem.wpn8 = 0; | |
| 8509 | 284 | tempitem.wpn9 = 0; | |
| 8510 | 284 | tempitem.wpn10 = 0; | |
| 8511 | 284 | break; | |
| 8512 | } | ||
| 8513 | case itype_triforcepiece: | ||
| 8514 | { | ||
| 8515 | 558 | tempitem.flags &= ~ (item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 8516 | 558 | tempitem.misc3 = 0; | |
| 8517 | 558 | tempitem.misc4 = 0; | |
| 8518 | 558 | tempitem.misc5 = 0; | |
| 8519 | 558 | tempitem.misc6 = 0; | |
| 8520 | 558 | tempitem.misc7 = 0; | |
| 8521 | 558 | tempitem.misc8 = 0; | |
| 8522 | 558 | tempitem.misc9 = 0; | |
| 8523 | 558 | tempitem.misc10 = 0; | |
| 8524 | 558 | tempitem.wpn = 0; | |
| 8525 | 558 | tempitem.wpn2 = 0; | |
| 8526 | 558 | tempitem.wpn3 = 0; | |
| 8527 | 558 | tempitem.wpn4 = 0; | |
| 8528 | 558 | tempitem.wpn5 = 0; | |
| 8529 | 558 | tempitem.wpn6 = 0; | |
| 8530 | 558 | tempitem.wpn7 = 0; | |
| 8531 | 558 | tempitem.wpn8 = 0; | |
| 8532 | 558 | tempitem.wpn9 = 0; | |
| 8533 | 558 | tempitem.wpn10 = 0; | |
| 8534 | 558 | break; | |
| 8535 | } | ||
| 8536 | case itype_map: case itype_compass: case itype_bosskey: | ||
| 8537 | { | ||
| 8538 | 842 | tempitem.flags &= ~ (item_flag1 | item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 8539 | 842 | tempitem.misc1 = 0; | |
| 8540 | 842 | tempitem.misc2 = 0; | |
| 8541 | 842 | tempitem.misc3 = 0; | |
| 8542 | 842 | tempitem.misc4 = 0; | |
| 8543 | 842 | tempitem.misc5 = 0; | |
| 8544 | 842 | tempitem.misc6 = 0; | |
| 8545 | 842 | tempitem.misc7 = 0; | |
| 8546 | 842 | tempitem.misc8 = 0; | |
| 8547 | 842 | tempitem.misc9 = 0; | |
| 8548 | 842 | tempitem.misc10 = 0; | |
| 8549 | 842 | tempitem.wpn = 0; | |
| 8550 | 842 | tempitem.wpn2 = 0; | |
| 8551 | 842 | tempitem.wpn3 = 0; | |
| 8552 | 842 | tempitem.wpn4 = 0; | |
| 8553 | 842 | tempitem.wpn5 = 0; | |
| 8554 | 842 | tempitem.wpn6 = 0; | |
| 8555 | 842 | tempitem.wpn7 = 0; | |
| 8556 | 842 | tempitem.wpn8 = 0; | |
| 8557 | 842 | tempitem.wpn9 = 0; | |
| 8558 | 842 | tempitem.wpn10 = 0; | |
| 8559 | 842 | break; | |
| 8560 | } | ||
| 8561 | case itype_quiver: | ||
| 8562 | { | ||
| 8563 | 1116 | tempitem.flags &= ~ (item_flag1 | item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 8564 | 1116 | tempitem.misc3 = 0; | |
| 8565 | 1116 | tempitem.misc4 = 0; | |
| 8566 | 1116 | tempitem.misc5 = 0; | |
| 8567 | 1116 | tempitem.misc6 = 0; | |
| 8568 | 1116 | tempitem.misc7 = 0; | |
| 8569 | 1116 | tempitem.misc8 = 0; | |
| 8570 | 1116 | tempitem.misc9 = 0; | |
| 8571 | 1116 | tempitem.misc10 = 0; | |
| 8572 | 1116 | tempitem.wpn = 0; | |
| 8573 | 1116 | tempitem.wpn2 = 0; | |
| 8574 | 1116 | tempitem.wpn3 = 0; | |
| 8575 | 1116 | tempitem.wpn4 = 0; | |
| 8576 | 1116 | tempitem.wpn5 = 0; | |
| 8577 | 1116 | tempitem.wpn6 = 0; | |
| 8578 | 1116 | tempitem.wpn7 = 0; | |
| 8579 | 1116 | tempitem.wpn8 = 0; | |
| 8580 | 1116 | tempitem.wpn9 = 0; | |
| 8581 | 1116 | tempitem.wpn10 = 0; | |
| 8582 | 1116 | break; | |
| 8583 | } | ||
| 8584 | case itype_lkey: | ||
| 8585 | { | ||
| 8586 | 780 | tempitem.flags &= ~ (item_flag1 | item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 8587 | 780 | tempitem.misc1 = 0; | |
| 8588 | 780 | tempitem.misc2 = 0; | |
| 8589 | 780 | tempitem.misc3 = 0; | |
| 8590 | 780 | tempitem.misc4 = 0; | |
| 8591 | 780 | tempitem.misc5 = 0; | |
| 8592 | 780 | tempitem.misc6 = 0; | |
| 8593 | 780 | tempitem.misc7 = 0; | |
| 8594 | 780 | tempitem.misc8 = 0; | |
| 8595 | 780 | tempitem.misc9 = 0; | |
| 8596 | 780 | tempitem.misc10 = 0; | |
| 8597 | 780 | tempitem.wpn = 0; | |
| 8598 | 780 | tempitem.wpn2 = 0; | |
| 8599 | 780 | tempitem.wpn3 = 0; | |
| 8600 | 780 | tempitem.wpn4 = 0; | |
| 8601 | 780 | tempitem.wpn5 = 0; | |
| 8602 | 780 | tempitem.wpn6 = 0; | |
| 8603 | 780 | tempitem.wpn7 = 0; | |
| 8604 | 780 | tempitem.wpn8 = 0; | |
| 8605 | 780 | tempitem.wpn9 = 0; | |
| 8606 | 780 | tempitem.wpn10 = 0; | |
| 8607 | 780 | break; | |
| 8608 | } | ||
| 8609 | case itype_cbyrna: | ||
| 8610 | { | ||
| 8611 | 279 | tempitem.flags &= ~ (item_flag2 | item_flag3 | item_flag5); | |
| 8612 | 279 | tempitem.misc4 = 0; | |
| 8613 | 279 | tempitem.misc5 = 0; | |
| 8614 | 279 | tempitem.misc6 = 0; | |
| 8615 | 279 | tempitem.misc7 = 0; | |
| 8616 | 279 | tempitem.misc8 = 0; | |
| 8617 | 279 | tempitem.misc9 = 0; | |
| 8618 | 279 | tempitem.misc10 = 0; | |
| 8619 | 279 | tempitem.wpn6 = 0; | |
| 8620 | 279 | tempitem.wpn7 = 0; | |
| 8621 | 279 | tempitem.wpn8 = 0; | |
| 8622 | 279 | tempitem.wpn9 = 0; | |
| 8623 | 279 | tempitem.wpn10 = 0; | |
| 8624 | 279 | break; | |
| 8625 | } | ||
| 8626 | case itype_rupee: case itype_arrowammo: | ||
| 8627 | { | ||
| 8628 | 3261 | tempitem.flags &= ~ (item_flag1 | item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 8629 | 3261 | tempitem.misc1 = 0; | |
| 8630 | 3261 | tempitem.misc2 = 0; | |
| 8631 | 3261 | tempitem.misc3 = 0; | |
| 8632 | 3261 | tempitem.misc4 = 0; | |
| 8633 | 3261 | tempitem.misc5 = 0; | |
| 8634 | 3261 | tempitem.misc6 = 0; | |
| 8635 | 3261 | tempitem.misc7 = 0; | |
| 8636 | 3261 | tempitem.misc8 = 0; | |
| 8637 | 3261 | tempitem.misc9 = 0; | |
| 8638 | 3261 | tempitem.misc10 = 0; | |
| 8639 | 3261 | tempitem.wpn = 0; | |
| 8640 | 3261 | tempitem.wpn2 = 0; | |
| 8641 | 3261 | tempitem.wpn3 = 0; | |
| 8642 | 3261 | tempitem.wpn4 = 0; | |
| 8643 | 3261 | tempitem.wpn5 = 0; | |
| 8644 | 3261 | tempitem.wpn6 = 0; | |
| 8645 | 3261 | tempitem.wpn7 = 0; | |
| 8646 | 3261 | tempitem.wpn8 = 0; | |
| 8647 | 3261 | tempitem.wpn9 = 0; | |
| 8648 | 3261 | tempitem.wpn10 = 0; | |
| 8649 | 3261 | break; | |
| 8650 | } | ||
| 8651 | case itype_fairy: | ||
| 8652 | { | ||
| 8653 | 545 | tempitem.flags &= ~ (item_flag3 | item_flag4 | item_flag5); | |
| 8654 | 545 | tempitem.misc4 = 0; | |
| 8655 | 545 | tempitem.misc5 = 0; | |
| 8656 | 545 | tempitem.misc6 = 0; | |
| 8657 | 545 | tempitem.misc7 = 0; | |
| 8658 | 545 | tempitem.misc8 = 0; | |
| 8659 | 545 | tempitem.misc9 = 0; | |
| 8660 | 545 | tempitem.misc10 = 0; | |
| 8661 | 545 | tempitem.wpn = 0; | |
| 8662 | 545 | tempitem.wpn2 = 0; | |
| 8663 | 545 | tempitem.wpn3 = 0; | |
| 8664 | 545 | tempitem.wpn4 = 0; | |
| 8665 | 545 | tempitem.wpn5 = 0; | |
| 8666 | 545 | tempitem.wpn6 = 0; | |
| 8667 | 545 | tempitem.wpn7 = 0; | |
| 8668 | 545 | tempitem.wpn8 = 0; | |
| 8669 | 545 | tempitem.wpn9 = 0; | |
| 8670 | 545 | tempitem.wpn10 = 0; | |
| 8671 | 545 | break; | |
| 8672 | } | ||
| 8673 | case itype_magic: case itype_heart: case itype_heartcontainer: case itype_heartpiece: case itype_killem: case itype_bombammo: | ||
| 8674 | { | ||
| 8675 | 2872 | tempitem.flags &= ~ (item_flag1 | item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 8676 | 2872 | tempitem.misc1 = 0; | |
| 8677 | 2872 | tempitem.misc2 = 0; | |
| 8678 | 2872 | tempitem.misc3 = 0; | |
| 8679 | 2872 | tempitem.misc4 = 0; | |
| 8680 | 2872 | tempitem.misc5 = 0; | |
| 8681 | 2872 | tempitem.misc6 = 0; | |
| 8682 | 2872 | tempitem.misc7 = 0; | |
| 8683 | 2872 | tempitem.misc8 = 0; | |
| 8684 | 2872 | tempitem.misc9 = 0; | |
| 8685 | 2872 | tempitem.misc10 = 0; | |
| 8686 | 2872 | tempitem.wpn = 0; | |
| 8687 | 2872 | tempitem.wpn2 = 0; | |
| 8688 | 2872 | tempitem.wpn3 = 0; | |
| 8689 | 2872 | tempitem.wpn4 = 0; | |
| 8690 | 2872 | tempitem.wpn5 = 0; | |
| 8691 | 2872 | tempitem.wpn6 = 0; | |
| 8692 | 2872 | tempitem.wpn7 = 0; | |
| 8693 | 2872 | tempitem.wpn8 = 0; | |
| 8694 | 2872 | tempitem.wpn9 = 0; | |
| 8695 | 2872 | tempitem.wpn10 = 0; | |
| 8696 | 2872 | break; | |
| 8697 | } | ||
| 8698 | case itype_bombbag: | ||
| 8699 | { | ||
| 8700 | 1116 | tempitem.flags &= ~ (item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 8701 | 1116 | tempitem.misc3 = 0; | |
| 8702 | 1116 | tempitem.misc4 = 0; | |
| 8703 | 1116 | tempitem.misc5 = 0; | |
| 8704 | 1116 | tempitem.misc6 = 0; | |
| 8705 | 1116 | tempitem.misc7 = 0; | |
| 8706 | 1116 | tempitem.misc8 = 0; | |
| 8707 | 1116 | tempitem.misc9 = 0; | |
| 8708 | 1116 | tempitem.misc10 = 0; | |
| 8709 | 1116 | tempitem.wpn = 0; | |
| 8710 | 1116 | tempitem.wpn2 = 0; | |
| 8711 | 1116 | tempitem.wpn3 = 0; | |
| 8712 | 1116 | tempitem.wpn4 = 0; | |
| 8713 | 1116 | tempitem.wpn5 = 0; | |
| 8714 | 1116 | tempitem.wpn6 = 0; | |
| 8715 | 1116 | tempitem.wpn7 = 0; | |
| 8716 | 1116 | tempitem.wpn8 = 0; | |
| 8717 | 1116 | tempitem.wpn9 = 0; | |
| 8718 | 1116 | tempitem.wpn10 = 0; | |
| 8719 | 1116 | break; | |
| 8720 | } | ||
| 8721 | case itype_rocs: | ||
| 8722 | { | ||
| 8723 | 279 | tempitem.flags &= ~ (item_flag1 | item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 8724 | 279 | tempitem.misc1 = 0; | |
| 8725 | 279 | tempitem.misc2 = 0; | |
| 8726 | 279 | tempitem.misc3 = 0; | |
| 8727 | 279 | tempitem.misc4 = 0; | |
| 8728 | 279 | tempitem.misc5 = 0; | |
| 8729 | 279 | tempitem.misc6 = 0; | |
| 8730 | 279 | tempitem.misc7 = 0; | |
| 8731 | 279 | tempitem.misc8 = 0; | |
| 8732 | 279 | tempitem.misc9 = 0; | |
| 8733 | 279 | tempitem.misc10 = 0; | |
| 8734 | 279 | tempitem.wpn = 0; | |
| 8735 | 279 | tempitem.wpn2 = 0; | |
| 8736 | 279 | tempitem.wpn3 = 0; | |
| 8737 | 279 | tempitem.wpn4 = 0; | |
| 8738 | 279 | tempitem.wpn5 = 0; | |
| 8739 | 279 | tempitem.wpn6 = 0; | |
| 8740 | 279 | tempitem.wpn7 = 0; | |
| 8741 | 279 | tempitem.wpn8 = 0; | |
| 8742 | 279 | tempitem.wpn9 = 0; | |
| 8743 | 279 | tempitem.wpn10 = 0; | |
| 8744 | 279 | break; | |
| 8745 | } | ||
| 8746 | case itype_hoverboots: | ||
| 8747 | { | ||
| 8748 | 279 | tempitem.flags &= ~ (item_flag1 | item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 8749 | 279 | tempitem.misc2 = 0; | |
| 8750 | 279 | tempitem.misc3 = 0; | |
| 8751 | 279 | tempitem.misc4 = 0; | |
| 8752 | 279 | tempitem.misc5 = 0; | |
| 8753 | 279 | tempitem.misc6 = 0; | |
| 8754 | 279 | tempitem.misc7 = 0; | |
| 8755 | 279 | tempitem.misc8 = 0; | |
| 8756 | 279 | tempitem.misc9 = 0; | |
| 8757 | 279 | tempitem.misc10 = 0; | |
| 8758 | 279 | tempitem.wpn2 = 0; | |
| 8759 | 279 | tempitem.wpn3 = 0; | |
| 8760 | 279 | tempitem.wpn4 = 0; | |
| 8761 | 279 | tempitem.wpn5 = 0; | |
| 8762 | 279 | tempitem.wpn6 = 0; | |
| 8763 | 279 | tempitem.wpn7 = 0; | |
| 8764 | 279 | tempitem.wpn8 = 0; | |
| 8765 | 279 | tempitem.wpn9 = 0; | |
| 8766 | 279 | tempitem.wpn10 = 0; | |
| 8767 | 279 | break; | |
| 8768 | } | ||
| 8769 | case itype_spinscroll: | ||
| 8770 | { | ||
| 8771 | 279 | tempitem.flags &= ~ (item_flag1 | item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 8772 | 279 | tempitem.misc2 = 0; | |
| 8773 | 279 | tempitem.misc3 = 0; | |
| 8774 | 279 | tempitem.misc4 = 0; | |
| 8775 | 279 | tempitem.misc5 = 0; | |
| 8776 | 279 | tempitem.misc6 = 0; | |
| 8777 | 279 | tempitem.misc7 = 0; | |
| 8778 | 279 | tempitem.misc8 = 0; | |
| 8779 | 279 | tempitem.misc9 = 0; | |
| 8780 | 279 | tempitem.misc10 = 0; | |
| 8781 | 279 | tempitem.wpn = 0; | |
| 8782 | 279 | tempitem.wpn2 = 0; | |
| 8783 | 279 | tempitem.wpn3 = 0; | |
| 8784 | 279 | tempitem.wpn4 = 0; | |
| 8785 | 279 | tempitem.wpn5 = 0; | |
| 8786 | 279 | tempitem.wpn6 = 0; | |
| 8787 | 279 | tempitem.wpn7 = 0; | |
| 8788 | 279 | tempitem.wpn8 = 0; | |
| 8789 | 279 | tempitem.wpn9 = 0; | |
| 8790 | 279 | tempitem.wpn10 = 0; | |
| 8791 | 279 | break; | |
| 8792 | } | ||
| 8793 | case itype_crossscroll: | ||
| 8794 | { | ||
| 8795 | 279 | tempitem.flags &= ~ (item_flag1 | item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 8796 | 279 | tempitem.misc1 = 0; | |
| 8797 | 279 | tempitem.misc2 = 0; | |
| 8798 | 279 | tempitem.misc3 = 0; | |
| 8799 | 279 | tempitem.misc4 = 0; | |
| 8800 | 279 | tempitem.misc5 = 0; | |
| 8801 | 279 | tempitem.misc6 = 0; | |
| 8802 | 279 | tempitem.misc7 = 0; | |
| 8803 | 279 | tempitem.misc8 = 0; | |
| 8804 | 279 | tempitem.misc9 = 0; | |
| 8805 | 279 | tempitem.misc10 = 0; | |
| 8806 | 279 | tempitem.wpn = 0; | |
| 8807 | 279 | tempitem.wpn2 = 0; | |
| 8808 | 279 | tempitem.wpn3 = 0; | |
| 8809 | 279 | tempitem.wpn4 = 0; | |
| 8810 | 279 | tempitem.wpn5 = 0; | |
| 8811 | 279 | tempitem.wpn6 = 0; | |
| 8812 | 279 | tempitem.wpn7 = 0; | |
| 8813 | 279 | tempitem.wpn8 = 0; | |
| 8814 | 279 | tempitem.wpn9 = 0; | |
| 8815 | 279 | tempitem.wpn10 = 0; | |
| 8816 | 279 | break; | |
| 8817 | } | ||
| 8818 | case itype_quakescroll: | ||
| 8819 | { | ||
| 8820 | 279 | tempitem.flags &= ~ (item_flag1 | item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 8821 | 279 | tempitem.misc3 = 0; | |
| 8822 | 279 | tempitem.misc4 = 0; | |
| 8823 | 279 | tempitem.misc5 = 0; | |
| 8824 | 279 | tempitem.misc6 = 0; | |
| 8825 | 279 | tempitem.misc7 = 0; | |
| 8826 | 279 | tempitem.misc8 = 0; | |
| 8827 | 279 | tempitem.misc9 = 0; | |
| 8828 | 279 | tempitem.misc10 = 0; | |
| 8829 | 279 | tempitem.wpn = 0; | |
| 8830 | 279 | tempitem.wpn2 = 0; | |
| 8831 | 279 | tempitem.wpn3 = 0; | |
| 8832 | 279 | tempitem.wpn4 = 0; | |
| 8833 | 279 | tempitem.wpn5 = 0; | |
| 8834 | 279 | tempitem.wpn6 = 0; | |
| 8835 | 279 | tempitem.wpn7 = 0; | |
| 8836 | 279 | tempitem.wpn8 = 0; | |
| 8837 | 279 | tempitem.wpn9 = 0; | |
| 8838 | 279 | tempitem.wpn10 = 0; | |
| 8839 | 279 | break; | |
| 8840 | } | ||
| 8841 | case itype_whispring: | ||
| 8842 | { | ||
| 8843 | 561 | tempitem.flags &= ~ (item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 8844 | 561 | tempitem.misc2 = 0; | |
| 8845 | 561 | tempitem.misc3 = 0; | |
| 8846 | 561 | tempitem.misc4 = 0; | |
| 8847 | 561 | tempitem.misc5 = 0; | |
| 8848 | 561 | tempitem.misc6 = 0; | |
| 8849 | 561 | tempitem.misc7 = 0; | |
| 8850 | 561 | tempitem.misc8 = 0; | |
| 8851 | 561 | tempitem.misc9 = 0; | |
| 8852 | 561 | tempitem.misc10 = 0; | |
| 8853 | 561 | tempitem.wpn = 0; | |
| 8854 | 561 | tempitem.wpn2 = 0; | |
| 8855 | 561 | tempitem.wpn3 = 0; | |
| 8856 | 561 | tempitem.wpn4 = 0; | |
| 8857 | 561 | tempitem.wpn5 = 0; | |
| 8858 | 561 | tempitem.wpn6 = 0; | |
| 8859 | 561 | tempitem.wpn7 = 0; | |
| 8860 | 561 | tempitem.wpn8 = 0; | |
| 8861 | 561 | tempitem.wpn9 = 0; | |
| 8862 | 561 | tempitem.wpn10 = 0; | |
| 8863 | 561 | break; | |
| 8864 | } | ||
| 8865 | case itype_chargering: | ||
| 8866 | { | ||
| 8867 | 558 | tempitem.flags &= ~ (item_flag1 | item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 8868 | 558 | tempitem.misc3 = 0; | |
| 8869 | 558 | tempitem.misc4 = 0; | |
| 8870 | 558 | tempitem.misc5 = 0; | |
| 8871 | 558 | tempitem.misc6 = 0; | |
| 8872 | 558 | tempitem.misc7 = 0; | |
| 8873 | 558 | tempitem.misc8 = 0; | |
| 8874 | 558 | tempitem.misc9 = 0; | |
| 8875 | 558 | tempitem.misc10 = 0; | |
| 8876 | 558 | tempitem.wpn = 0; | |
| 8877 | 558 | tempitem.wpn2 = 0; | |
| 8878 | 558 | tempitem.wpn3 = 0; | |
| 8879 | 558 | tempitem.wpn4 = 0; | |
| 8880 | 558 | tempitem.wpn5 = 0; | |
| 8881 | 558 | tempitem.wpn6 = 0; | |
| 8882 | 558 | tempitem.wpn7 = 0; | |
| 8883 | 558 | tempitem.wpn8 = 0; | |
| 8884 | 558 | tempitem.wpn9 = 0; | |
| 8885 | 558 | tempitem.wpn10 = 0; | |
| 8886 | 558 | break; | |
| 8887 | } | ||
| 8888 | case itype_perilscroll: | ||
| 8889 | { | ||
| 8890 | 279 | tempitem.flags &= ~ (item_flag1 | item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 8891 | 279 | tempitem.misc2 = 0; | |
| 8892 | 279 | tempitem.misc3 = 0; | |
| 8893 | 279 | tempitem.misc4 = 0; | |
| 8894 | 279 | tempitem.misc5 = 0; | |
| 8895 | 279 | tempitem.misc6 = 0; | |
| 8896 | 279 | tempitem.misc7 = 0; | |
| 8897 | 279 | tempitem.misc8 = 0; | |
| 8898 | 279 | tempitem.misc9 = 0; | |
| 8899 | 279 | tempitem.misc10 = 0; | |
| 8900 | 279 | tempitem.wpn = 0; | |
| 8901 | 279 | tempitem.wpn2 = 0; | |
| 8902 | 279 | tempitem.wpn3 = 0; | |
| 8903 | 279 | tempitem.wpn4 = 0; | |
| 8904 | 279 | tempitem.wpn5 = 0; | |
| 8905 | 279 | tempitem.wpn6 = 0; | |
| 8906 | 279 | tempitem.wpn7 = 0; | |
| 8907 | 279 | tempitem.wpn8 = 0; | |
| 8908 | 279 | tempitem.wpn9 = 0; | |
| 8909 | 279 | tempitem.wpn10 = 0; | |
| 8910 | 279 | break; | |
| 8911 | } | ||
| 8912 | case itype_wealthmedal: | ||
| 8913 | { | ||
| 8914 | 840 | tempitem.flags &= ~ (item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 8915 | 840 | tempitem.misc2 = 0; | |
| 8916 | 840 | tempitem.misc3 = 0; | |
| 8917 | 840 | tempitem.misc4 = 0; | |
| 8918 | 840 | tempitem.misc5 = 0; | |
| 8919 | 840 | tempitem.misc6 = 0; | |
| 8920 | 840 | tempitem.misc7 = 0; | |
| 8921 | 840 | tempitem.misc8 = 0; | |
| 8922 | 840 | tempitem.misc9 = 0; | |
| 8923 | 840 | tempitem.misc10 = 0; | |
| 8924 | 840 | tempitem.wpn = 0; | |
| 8925 | 840 | tempitem.wpn2 = 0; | |
| 8926 | 840 | tempitem.wpn3 = 0; | |
| 8927 | 840 | tempitem.wpn4 = 0; | |
| 8928 | 840 | tempitem.wpn5 = 0; | |
| 8929 | 840 | tempitem.wpn6 = 0; | |
| 8930 | 840 | tempitem.wpn7 = 0; | |
| 8931 | 840 | tempitem.wpn8 = 0; | |
| 8932 | 840 | tempitem.wpn9 = 0; | |
| 8933 | 840 | tempitem.wpn10 = 0; | |
| 8934 | 840 | break; | |
| 8935 | } | ||
| 8936 | case itype_heartring: | ||
| 8937 | { | ||
| 8938 | 843 | tempitem.flags &= ~ (item_flag1 | item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 8939 | 843 | tempitem.misc3 = 0; | |
| 8940 | 843 | tempitem.misc4 = 0; | |
| 8941 | 843 | tempitem.misc5 = 0; | |
| 8942 | 843 | tempitem.misc6 = 0; | |
| 8943 | 843 | tempitem.misc7 = 0; | |
| 8944 | 843 | tempitem.misc8 = 0; | |
| 8945 | 843 | tempitem.misc9 = 0; | |
| 8946 | 843 | tempitem.misc10 = 0; | |
| 8947 | 843 | tempitem.wpn = 0; | |
| 8948 | 843 | tempitem.wpn2 = 0; | |
| 8949 | 843 | tempitem.wpn3 = 0; | |
| 8950 | 843 | tempitem.wpn4 = 0; | |
| 8951 | 843 | tempitem.wpn5 = 0; | |
| 8952 | 843 | tempitem.wpn6 = 0; | |
| 8953 | 843 | tempitem.wpn7 = 0; | |
| 8954 | 843 | tempitem.wpn8 = 0; | |
| 8955 | 843 | tempitem.wpn9 = 0; | |
| 8956 | 843 | tempitem.wpn10 = 0; | |
| 8957 | 843 | break; | |
| 8958 | } | ||
| 8959 | case itype_magicring: | ||
| 8960 | { | ||
| 8961 | 1128 | tempitem.flags &= ~ (item_flag1 | item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 8962 | 1128 | tempitem.misc3 = 0; | |
| 8963 | 1128 | tempitem.misc4 = 0; | |
| 8964 | 1128 | tempitem.misc5 = 0; | |
| 8965 | 1128 | tempitem.misc6 = 0; | |
| 8966 | 1128 | tempitem.misc7 = 0; | |
| 8967 | 1128 | tempitem.misc8 = 0; | |
| 8968 | 1128 | tempitem.misc9 = 0; | |
| 8969 | 1128 | tempitem.misc10 = 0; | |
| 8970 | 1128 | tempitem.wpn = 0; | |
| 8971 | 1128 | tempitem.wpn2 = 0; | |
| 8972 | 1128 | tempitem.wpn3 = 0; | |
| 8973 | 1128 | tempitem.wpn4 = 0; | |
| 8974 | 1128 | tempitem.wpn5 = 0; | |
| 8975 | 1128 | tempitem.wpn6 = 0; | |
| 8976 | 1128 | tempitem.wpn7 = 0; | |
| 8977 | 1128 | tempitem.wpn8 = 0; | |
| 8978 | 1128 | tempitem.wpn9 = 0; | |
| 8979 | 1128 | tempitem.wpn10 = 0; | |
| 8980 | 1128 | break; | |
| 8981 | } | ||
| 8982 | case itype_spinscroll2: | ||
| 8983 | { | ||
| 8984 | 279 | tempitem.flags &= ~ (item_flag1 | item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 8985 | 279 | tempitem.misc2 = 0; | |
| 8986 | 279 | tempitem.misc3 = 0; | |
| 8987 | 279 | tempitem.misc4 = 0; | |
| 8988 | 279 | tempitem.misc5 = 0; | |
| 8989 | 279 | tempitem.misc6 = 0; | |
| 8990 | 279 | tempitem.misc7 = 0; | |
| 8991 | 279 | tempitem.misc8 = 0; | |
| 8992 | 279 | tempitem.misc9 = 0; | |
| 8993 | 279 | tempitem.misc10 = 0; | |
| 8994 | 279 | tempitem.wpn = 0; | |
| 8995 | 279 | tempitem.wpn2 = 0; | |
| 8996 | 279 | tempitem.wpn3 = 0; | |
| 8997 | 279 | tempitem.wpn4 = 0; | |
| 8998 | 279 | tempitem.wpn5 = 0; | |
| 8999 | 279 | tempitem.wpn6 = 0; | |
| 9000 | 279 | tempitem.wpn7 = 0; | |
| 9001 | 279 | tempitem.wpn8 = 0; | |
| 9002 | 279 | tempitem.wpn9 = 0; | |
| 9003 | 279 | tempitem.wpn10 = 0; | |
| 9004 | 279 | break; | |
| 9005 | } | ||
| 9006 | case itype_quakescroll2: | ||
| 9007 | { | ||
| 9008 | 279 | tempitem.flags &= ~ (item_flag1 | item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 9009 | 279 | tempitem.misc3 = 0; | |
| 9010 | 279 | tempitem.misc4 = 0; | |
| 9011 | 279 | tempitem.misc5 = 0; | |
| 9012 | 279 | tempitem.misc6 = 0; | |
| 9013 | 279 | tempitem.misc7 = 0; | |
| 9014 | 279 | tempitem.misc8 = 0; | |
| 9015 | 279 | tempitem.misc9 = 0; | |
| 9016 | 279 | tempitem.misc10 = 0; | |
| 9017 | 279 | tempitem.wpn = 0; | |
| 9018 | 279 | tempitem.wpn2 = 0; | |
| 9019 | 279 | tempitem.wpn3 = 0; | |
| 9020 | 279 | tempitem.wpn4 = 0; | |
| 9021 | 279 | tempitem.wpn5 = 0; | |
| 9022 | 279 | tempitem.wpn6 = 0; | |
| 9023 | 279 | tempitem.wpn7 = 0; | |
| 9024 | 279 | tempitem.wpn8 = 0; | |
| 9025 | 279 | tempitem.wpn9 = 0; | |
| 9026 | 279 | tempitem.wpn10 = 0; | |
| 9027 | 279 | break; | |
| 9028 | } | ||
| 9029 | case itype_agony: | ||
| 9030 | { | ||
| 9031 | 279 | tempitem.flags &= ~ (item_flag1 | item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 9032 | 279 | tempitem.misc2 = 0; | |
| 9033 | 279 | tempitem.misc3 = 0; | |
| 9034 | 279 | tempitem.misc4 = 0; | |
| 9035 | 279 | tempitem.misc5 = 0; | |
| 9036 | 279 | tempitem.misc6 = 0; | |
| 9037 | 279 | tempitem.misc7 = 0; | |
| 9038 | 279 | tempitem.misc8 = 0; | |
| 9039 | 279 | tempitem.misc9 = 0; | |
| 9040 | 279 | tempitem.misc10 = 0; | |
| 9041 | 279 | tempitem.wpn = 0; | |
| 9042 | 279 | tempitem.wpn2 = 0; | |
| 9043 | 279 | tempitem.wpn3 = 0; | |
| 9044 | 279 | tempitem.wpn4 = 0; | |
| 9045 | 279 | tempitem.wpn5 = 0; | |
| 9046 | 279 | tempitem.wpn6 = 0; | |
| 9047 | 279 | tempitem.wpn7 = 0; | |
| 9048 | 279 | tempitem.wpn8 = 0; | |
| 9049 | 279 | tempitem.wpn9 = 0; | |
| 9050 | 279 | tempitem.wpn10 = 0; | |
| 9051 | 279 | break; | |
| 9052 | } | ||
| 9053 | case itype_stompboots: | ||
| 9054 | { | ||
| 9055 | 279 | tempitem.flags &= ~ (item_flag1 | item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 9056 | 279 | tempitem.misc1 = 0; | |
| 9057 | 279 | tempitem.misc2 = 0; | |
| 9058 | 279 | tempitem.misc3 = 0; | |
| 9059 | 279 | tempitem.misc4 = 0; | |
| 9060 | 279 | tempitem.misc5 = 0; | |
| 9061 | 279 | tempitem.misc6 = 0; | |
| 9062 | 279 | tempitem.misc7 = 0; | |
| 9063 | 279 | tempitem.misc8 = 0; | |
| 9064 | 279 | tempitem.misc9 = 0; | |
| 9065 | 279 | tempitem.misc10 = 0; | |
| 9066 | 279 | tempitem.wpn = 0; | |
| 9067 | 279 | tempitem.wpn2 = 0; | |
| 9068 | 279 | tempitem.wpn3 = 0; | |
| 9069 | 279 | tempitem.wpn4 = 0; | |
| 9070 | 279 | tempitem.wpn5 = 0; | |
| 9071 | 279 | tempitem.wpn6 = 0; | |
| 9072 | 279 | tempitem.wpn7 = 0; | |
| 9073 | 279 | tempitem.wpn8 = 0; | |
| 9074 | 279 | tempitem.wpn9 = 0; | |
| 9075 | 279 | tempitem.wpn10 = 0; | |
| 9076 | 279 | break; | |
| 9077 | } | ||
| 9078 | case itype_whimsicalring: | ||
| 9079 | { | ||
| 9080 | 279 | tempitem.flags &= ~ (item_flag1 | item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 9081 | 279 | tempitem.misc2 = 0; | |
| 9082 | 279 | tempitem.misc3 = 0; | |
| 9083 | 279 | tempitem.misc4 = 0; | |
| 9084 | 279 | tempitem.misc5 = 0; | |
| 9085 | 279 | tempitem.misc6 = 0; | |
| 9086 | 279 | tempitem.misc7 = 0; | |
| 9087 | 279 | tempitem.misc8 = 0; | |
| 9088 | 279 | tempitem.misc9 = 0; | |
| 9089 | 279 | tempitem.misc10 = 0; | |
| 9090 | 279 | tempitem.wpn = 0; | |
| 9091 | 279 | tempitem.wpn2 = 0; | |
| 9092 | 279 | tempitem.wpn3 = 0; | |
| 9093 | 279 | tempitem.wpn4 = 0; | |
| 9094 | 279 | tempitem.wpn5 = 0; | |
| 9095 | 279 | tempitem.wpn6 = 0; | |
| 9096 | 279 | tempitem.wpn7 = 0; | |
| 9097 | 279 | tempitem.wpn8 = 0; | |
| 9098 | 279 | tempitem.wpn9 = 0; | |
| 9099 | 279 | tempitem.wpn10 = 0; | |
| 9100 | 279 | break; | |
| 9101 | } | ||
| 9102 | case itype_perilring: | ||
| 9103 | { | ||
| 9104 | 306 | tempitem.flags &= ~ (item_flag1 | item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 9105 | 306 | tempitem.misc2 = 0; | |
| 9106 | 306 | tempitem.misc3 = 0; | |
| 9107 | 306 | tempitem.misc4 = 0; | |
| 9108 | 306 | tempitem.misc5 = 0; | |
| 9109 | 306 | tempitem.misc6 = 0; | |
| 9110 | 306 | tempitem.misc7 = 0; | |
| 9111 | 306 | tempitem.misc8 = 0; | |
| 9112 | 306 | tempitem.misc9 = 0; | |
| 9113 | 306 | tempitem.misc10 = 0; | |
| 9114 | 306 | tempitem.wpn = 0; | |
| 9115 | 306 | tempitem.wpn2 = 0; | |
| 9116 | 306 | tempitem.wpn3 = 0; | |
| 9117 | 306 | tempitem.wpn4 = 0; | |
| 9118 | 306 | tempitem.wpn5 = 0; | |
| 9119 | 306 | tempitem.wpn6 = 0; | |
| 9120 | 306 | tempitem.wpn7 = 0; | |
| 9121 | 306 | tempitem.wpn8 = 0; | |
| 9122 | 306 | tempitem.wpn9 = 0; | |
| 9123 | 306 | tempitem.wpn10 = 0; | |
| 9124 | 306 | break; | |
| 9125 | } | ||
| 9126 | case itype_custom1: case itype_custom2: case itype_custom3: case itype_custom4: case itype_custom5: | ||
| 9127 | case itype_custom6: case itype_custom7: case itype_custom8: case itype_custom9: case itype_custom10: | ||
| 9128 | case itype_custom11: case itype_custom12: case itype_custom13: case itype_custom14: case itype_custom15: | ||
| 9129 | case itype_custom16: case itype_custom17: case itype_custom18: case itype_custom19: case itype_custom20: | ||
| 9130 | case itype_bowandarrow: case itype_letterpotion: case itype_misc: | ||
| 9131 | { | ||
| 9132 | 10652 | tempitem.flags &= ~ (item_flag1 | item_flag2 | item_flag3 | item_flag4 | item_flag5); | |
| 9133 | 10652 | tempitem.misc1 = 0; | |
| 9134 | 10652 | tempitem.misc2 = 0; | |
| 9135 | 10652 | tempitem.misc3 = 0; | |
| 9136 | 10652 | tempitem.misc4 = 0; | |
| 9137 | 10652 | tempitem.misc5 = 0; | |
| 9138 | 10652 | tempitem.misc6 = 0; | |
| 9139 | 10652 | tempitem.misc7 = 0; | |
| 9140 | 10652 | tempitem.misc8 = 0; | |
| 9141 | 10652 | tempitem.misc9 = 0; | |
| 9142 | 10652 | tempitem.misc10 = 0; | |
| 9143 | 10652 | tempitem.wpn = 0; | |
| 9144 | 10652 | tempitem.wpn2 = 0; | |
| 9145 | 10652 | tempitem.wpn3 = 0; | |
| 9146 | 10652 | tempitem.wpn4 = 0; | |
| 9147 | 10652 | tempitem.wpn5 = 0; | |
| 9148 | 10652 | tempitem.wpn6 = 0; | |
| 9149 | 10652 | tempitem.wpn7 = 0; | |
| 9150 | 10652 | tempitem.wpn8 = 0; | |
| 9151 | 10652 | tempitem.wpn9 = 0; | |
| 9152 | 10652 | tempitem.wpn10 = 0; | |
| 9153 | 10652 | break; | |
| 9154 | } | ||
| 9155 | } | ||
| 9156 | 72192 | } | |
| 9157 | //Port quest rules to items | ||
| 9158 |
2/2✓ Branch 0 taken 50176 times.
✓ Branch 1 taken 72192 times.
|
122368 | if( s_version <= 31) |
| 9159 | { | ||
| 9160 |
2/2✓ Branch 0 taken 295 times.
✓ Branch 1 taken 71897 times.
|
72192 | if(tempitem.family == itype_bomb) |
| 9161 | { | ||
| 9162 |
2/2✓ Branch 0 taken 156 times.
✓ Branch 1 taken 139 times.
|
295 | if ( get_qr(qr_OUCHBOMBS) ) tempitem.flags |= item_flag2; |
| 9163 | 139 | else tempitem.flags &= ~ item_flag2; | |
| 9164 | 295 | } | |
| 9165 |
2/2✓ Branch 0 taken 281 times.
✓ Branch 1 taken 71616 times.
|
71897 | else if(tempitem.family == itype_sbomb) |
| 9166 | { | ||
| 9167 |
2/2✓ Branch 0 taken 158 times.
✓ Branch 1 taken 123 times.
|
281 | if ( get_qr(qr_OUCHBOMBS) ) tempitem.flags |= item_flag2; |
| 9168 | 123 | else tempitem.flags &= ~ item_flag2; | |
| 9169 | 281 | } | |
| 9170 | |||
| 9171 |
2/2✓ Branch 0 taken 844 times.
✓ Branch 1 taken 70772 times.
|
71616 | else if(tempitem.family == itype_brang) |
| 9172 | { | ||
| 9173 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 844 times.
|
844 | if ( get_qr(qr_BRANGPICKUP) ) tempitem.flags |= item_flag4; |
| 9174 | 844 | else tempitem.flags &= ~ item_flag4; | |
| 9175 | 844 | } | |
| 9176 |
2/2✓ Branch 0 taken 70475 times.
✓ Branch 1 taken 297 times.
|
70772 | else if(tempitem.family == itype_wand) |
| 9177 | { | ||
| 9178 |
2/2✓ Branch 0 taken 18 times.
✓ Branch 1 taken 279 times.
|
297 | if ( get_qr(qr_NOWANDMELEE) ) tempitem.flags |= item_flag3; |
| 9179 | 279 | else tempitem.flags &= ~ item_flag3; | |
| 9180 | 297 | } | |
| 9181 | 72192 | } | |
| 9182 | |||
| 9183 | //Port quest rules to items | ||
| 9184 |
2/2✓ Branch 0 taken 50176 times.
✓ Branch 1 taken 72192 times.
|
122368 | if( s_version <= 37) |
| 9185 | { | ||
| 9186 |
2/2✓ Branch 0 taken 282 times.
✓ Branch 1 taken 71910 times.
|
72192 | if(tempitem.family == itype_flippers) |
| 9187 | { | ||
| 9188 |
2/2✓ Branch 0 taken 79 times.
✓ Branch 1 taken 203 times.
|
282 | if ( (get_qr(qr_NODIVING)) ) tempitem.flags |= item_flag1; |
| 9189 | 203 | else tempitem.flags &= ~ item_flag1; | |
| 9190 | 282 | } | |
| 9191 |
2/2✓ Branch 0 taken 54363 times.
✓ Branch 1 taken 17547 times.
|
71910 | else if(tempitem.family == itype_sword) |
| 9192 | { | ||
| 9193 |
2/2✓ Branch 0 taken 438 times.
✓ Branch 1 taken 17109 times.
|
17547 | if ( (get_qr(qr_QUICKSWORD)) ) tempitem.flags |= item_flag5; |
| 9194 | 17109 | else tempitem.flags &= ~ item_flag5; | |
| 9195 | 17547 | } | |
| 9196 |
2/2✓ Branch 0 taken 297 times.
✓ Branch 1 taken 54066 times.
|
54363 | else if(tempitem.family == itype_wand) |
| 9197 | { | ||
| 9198 |
2/2✓ Branch 0 taken 9 times.
✓ Branch 1 taken 288 times.
|
297 | if ( (get_qr(qr_QUICKSWORD)) ) tempitem.flags |= item_flag5; |
| 9199 | 288 | else tempitem.flags &= ~ item_flag5; | |
| 9200 | 297 | } | |
| 9201 |
4/4✓ Branch 0 taken 53771 times.
✓ Branch 1 taken 295 times.
✓ Branch 2 taken 600 times.
✓ Branch 3 taken 53171 times.
|
54066 | else if(tempitem.family == itype_book || tempitem.family == itype_candle) |
| 9202 | { | ||
| 9203 | //@Emily: What was qrFIREPROOFHERO2 again, and does that also need to enable this? | ||
| 9204 |
2/2✓ Branch 0 taken 375 times.
✓ Branch 1 taken 520 times.
|
895 | if ( (get_qr(qr_FIREPROOFHERO)) ) tempitem.flags |= item_flag3; |
| 9205 | 520 | else tempitem.flags &= ~ item_flag3; | |
| 9206 | 895 | } | |
| 9207 | 72192 | } | |
| 9208 | |||
| 9209 |
2/2✓ Branch 0 taken 50176 times.
✓ Branch 1 taken 72192 times.
|
122368 | if( s_version < 38) |
| 9210 | { | ||
| 9211 |
4/4✓ Branch 0 taken 71348 times.
✓ Branch 1 taken 844 times.
✓ Branch 2 taken 560 times.
✓ Branch 3 taken 70788 times.
|
72192 | if(tempitem.family == itype_brang || tempitem.family == itype_hookshot) |
| 9212 | { | ||
| 9213 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1404 times.
|
1404 | if(get_qr(qr_BRANGPICKUP)) tempitem.flags |= item_flag4; |
| 9214 | 1404 | else tempitem.flags &= ~item_flag4; | |
| 9215 | |||
| 9216 |
2/2✓ Branch 0 taken 673 times.
✓ Branch 1 taken 731 times.
|
1404 | if(get_qr(qr_Z3BRANG_HSHOT)) tempitem.flags |= item_flag5 | item_flag6; |
| 9217 | 731 | else tempitem.flags &= ~(item_flag5|item_flag6); | |
| 9218 | 1404 | } | |
| 9219 |
2/2✓ Branch 0 taken 69957 times.
✓ Branch 1 taken 831 times.
|
70788 | else if(tempitem.family == itype_arrow) |
| 9220 | { | ||
| 9221 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 831 times.
|
831 | if(get_qr(qr_BRANGPICKUP)) tempitem.flags |= item_flag4; |
| 9222 | 831 | else tempitem.flags &= ~item_flag4; | |
| 9223 | |||
| 9224 |
2/2✓ Branch 0 taken 396 times.
✓ Branch 1 taken 435 times.
|
831 | if(get_qr(qr_Z3BRANG_HSHOT)) tempitem.flags &= ~item_flag2; |
| 9225 | 435 | else tempitem.flags |= item_flag2; | |
| 9226 | 831 | } | |
| 9227 | 72192 | } | |
| 9228 | |||
| 9229 |
2/2✓ Branch 0 taken 50176 times.
✓ Branch 1 taken 72192 times.
|
122368 | if( s_version < 39) |
| 9230 | { | ||
| 9231 |
6/6✓ Branch 0 taken 71913 times.
✓ Branch 1 taken 279 times.
✓ Branch 2 taken 71618 times.
✓ Branch 3 taken 295 times.
✓ Branch 4 taken 600 times.
✓ Branch 5 taken 71018 times.
|
72192 | if(tempitem.family == itype_divinefire || tempitem.family == itype_book || tempitem.family == itype_candle) |
| 9232 | { | ||
| 9233 |
2/2✓ Branch 0 taken 16 times.
✓ Branch 1 taken 1158 times.
|
1174 | if(get_qr(qr_TEMPCANDLELIGHT)) tempitem.flags |= item_flag5; |
| 9234 | 1158 | else tempitem.flags &= ~item_flag5; | |
| 9235 | 1174 | } | |
| 9236 |
2/2✓ Branch 0 taken 614 times.
✓ Branch 1 taken 70404 times.
|
71018 | else if(tempitem.family == itype_potion) |
| 9237 | { | ||
| 9238 |
2/2✓ Branch 0 taken 162 times.
✓ Branch 1 taken 452 times.
|
614 | if(get_qr(qr_NONBUBBLEMEDICINE)) |
| 9239 | { | ||
| 9240 | 162 | tempitem.flags &= ~(item_flag3|item_flag4); | |
| 9241 | 162 | } | |
| 9242 | else | ||
| 9243 | { | ||
| 9244 | 452 | tempitem.flags |= item_flag3; | |
| 9245 |
2/2✓ Branch 0 taken 119 times.
✓ Branch 1 taken 333 times.
|
452 | if(get_qr(qr_ITEMBUBBLE))tempitem.flags |= item_flag4; |
| 9246 | 333 | else tempitem.flags &= ~item_flag4; | |
| 9247 | } | ||
| 9248 | 614 | } | |
| 9249 |
2/2✓ Branch 0 taken 69846 times.
✓ Branch 1 taken 558 times.
|
70404 | else if(tempitem.family == itype_triforcepiece) |
| 9250 | { | ||
| 9251 |
2/2✓ Branch 0 taken 84 times.
✓ Branch 1 taken 474 times.
|
558 | if(get_qr(qr_NONBUBBLETRIFORCE)) |
| 9252 | { | ||
| 9253 | 84 | tempitem.flags |= item_flag3; | |
| 9254 |
2/2✓ Branch 0 taken 56 times.
✓ Branch 1 taken 28 times.
|
84 | if(get_qr(qr_ITEMBUBBLE))tempitem.flags |= item_flag4; |
| 9255 | 28 | else tempitem.flags &= ~item_flag4; | |
| 9256 | 84 | } | |
| 9257 | else | ||
| 9258 | { | ||
| 9259 | 474 | tempitem.flags &= ~(item_flag3|item_flag4); | |
| 9260 | } | ||
| 9261 | 558 | } | |
| 9262 | 72192 | } | |
| 9263 | |||
| 9264 |
2/2✓ Branch 0 taken 50176 times.
✓ Branch 1 taken 72192 times.
|
122368 | if( s_version < 40) |
| 9265 | { | ||
| 9266 |
4/4✓ Branch 0 taken 71275 times.
✓ Branch 1 taken 917 times.
✓ Branch 2 taken 306 times.
✓ Branch 3 taken 70969 times.
|
72192 | if(tempitem.family == itype_ring || tempitem.family == itype_perilring) |
| 9267 | { | ||
| 9268 |
2/2✓ Branch 0 taken 289 times.
✓ Branch 1 taken 934 times.
|
1223 | if(get_qr(qr_RINGAFFECTDAMAGE))tempitem.flags |= item_flag1; |
| 9269 | 934 | else tempitem.flags &= ~item_flag1; | |
| 9270 | 1223 | } | |
| 9271 |
8/8✓ Branch 0 taken 70369 times.
✓ Branch 1 taken 600 times.
✓ Branch 2 taken 52822 times.
✓ Branch 3 taken 17547 times.
✓ Branch 4 taken 52525 times.
✓ Branch 5 taken 297 times.
✓ Branch 6 taken 279 times.
✓ Branch 7 taken 52246 times.
|
70969 | else if(tempitem.family == itype_candle || tempitem.family == itype_sword || tempitem.family == itype_wand || tempitem.family == itype_cbyrna) |
| 9272 | { | ||
| 9273 |
2/2✓ Branch 0 taken 108 times.
✓ Branch 1 taken 18615 times.
|
18723 | if(get_qr(qr_SLASHFLIPFIX))tempitem.flags |= item_flag8; |
| 9274 | 18615 | else tempitem.flags &= ~item_flag8; | |
| 9275 | 18723 | } | |
| 9276 |
6/6✓ Branch 0 taken 54645 times.
✓ Branch 1 taken 17547 times.
✓ Branch 2 taken 54348 times.
✓ Branch 3 taken 297 times.
✓ Branch 4 taken 282 times.
✓ Branch 5 taken 54066 times.
|
72192 | if(tempitem.family == itype_sword || tempitem.family == itype_wand || tempitem.family == itype_hammer) |
| 9277 | { | ||
| 9278 |
2/2✓ Branch 0 taken 78 times.
✓ Branch 1 taken 18048 times.
|
18126 | if(get_qr(qr_NOITEMMELEE))tempitem.flags |= item_flag7; |
| 9279 | 18048 | else tempitem.flags &= ~item_flag7; | |
| 9280 | 18126 | } | |
| 9281 |
2/2✓ Branch 0 taken 53787 times.
✓ Branch 1 taken 279 times.
|
54066 | else if(tempitem.family == itype_cbyrna) |
| 9282 | { | ||
| 9283 | 279 | tempitem.flags |= item_flag7; | |
| 9284 | 279 | } | |
| 9285 | 72192 | } | |
| 9286 | |||
| 9287 |
2/2✓ Branch 0 taken 50176 times.
✓ Branch 1 taken 72192 times.
|
122368 | if( s_version < 41 ) |
| 9288 | { | ||
| 9289 |
2/2✓ Branch 0 taken 54645 times.
✓ Branch 1 taken 17547 times.
|
72192 | if(tempitem.family == itype_sword) |
| 9290 | { | ||
| 9291 |
2/2✓ Branch 0 taken 236 times.
✓ Branch 1 taken 17311 times.
|
17547 | if(get_qr(qr_SWORDMIRROR))tempitem.flags |= item_flag9; |
| 9292 | 17311 | else tempitem.flags &= ~item_flag9; | |
| 9293 | |||
| 9294 |
2/2✓ Branch 0 taken 428 times.
✓ Branch 1 taken 17119 times.
|
17547 | if(get_qr(qr_SLOWCHARGINGWALK))tempitem.flags |= item_flag10; |
| 9295 | 17119 | else tempitem.flags &= ~item_flag10; | |
| 9296 | 17547 | } | |
| 9297 | 72192 | } | |
| 9298 | |||
| 9299 |
2/2✓ Branch 0 taken 50176 times.
✓ Branch 1 taken 72192 times.
|
122368 | if( s_version < 42 ) |
| 9300 | { | ||
| 9301 |
2/2✓ Branch 0 taken 297 times.
✓ Branch 1 taken 71895 times.
|
72192 | if(tempitem.family == itype_wand) |
| 9302 | { | ||
| 9303 |
2/2✓ Branch 0 taken 18 times.
✓ Branch 1 taken 279 times.
|
297 | if(get_qr(qr_NOWANDMELEE))tempitem.flags |= item_flag3; |
| 9304 | 279 | else tempitem.flags &= ~item_flag3; | |
| 9305 | |||
| 9306 | 297 | tempitem.flags &= ~item_flag6; | |
| 9307 | 297 | } | |
| 9308 |
2/2✓ Branch 0 taken 282 times.
✓ Branch 1 taken 71613 times.
|
71895 | else if(tempitem.family == itype_hammer) |
| 9309 | { | ||
| 9310 | 282 | tempitem.flags &= ~item_flag3; | |
| 9311 | 282 | } | |
| 9312 |
2/2✓ Branch 0 taken 279 times.
✓ Branch 1 taken 71334 times.
|
71613 | else if(tempitem.family == itype_cbyrna) |
| 9313 | { | ||
| 9314 | 279 | tempitem.flags |= item_flag3; | |
| 9315 | |||
| 9316 | 279 | tempitem.flags &= ~item_flag6; | |
| 9317 | 279 | } | |
| 9318 |
2/2✓ Branch 0 taken 53787 times.
✓ Branch 1 taken 17547 times.
|
71334 | else if(tempitem.family == itype_sword) |
| 9319 | { | ||
| 9320 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 17547 times.
|
17547 | if(get_qr(qr_MELEEMAGICCOST))tempitem.flags |= item_flag6; |
| 9321 | 17547 | else tempitem.flags &= ~item_flag6; | |
| 9322 | 17547 | } | |
| 9323 | 72192 | } | |
| 9324 | |||
| 9325 |
2/2✓ Branch 0 taken 50176 times.
✓ Branch 1 taken 72192 times.
|
122368 | if( s_version < 43 ) |
| 9326 | { | ||
| 9327 |
2/2✓ Branch 0 taken 71865 times.
✓ Branch 1 taken 327 times.
|
72192 | if(tempitem.family == itype_whistle) |
| 9328 | { | ||
| 9329 |
2/2✓ Branch 0 taken 10 times.
✓ Branch 1 taken 317 times.
|
327 | if(get_qr(qr_WHIRLWINDMIRROR))tempitem.flags |= item_flag3; |
| 9330 | 317 | else tempitem.flags &= ~item_flag3; | |
| 9331 | 327 | } | |
| 9332 | 72192 | } | |
| 9333 | |||
| 9334 |
2/2✓ Branch 0 taken 50176 times.
✓ Branch 1 taken 72192 times.
|
122368 | if( s_version < 45 ) |
| 9335 | { | ||
| 9336 |
2/2✓ Branch 0 taken 71910 times.
✓ Branch 1 taken 282 times.
|
72192 | if(tempitem.family == itype_flippers) |
| 9337 | { | ||
| 9338 | 282 | tempitem.misc1 = 50; //Dive length, default 50 frames -V | |
| 9339 | 282 | tempitem.misc2 = 30; //Dive cooldown, default 30 frames -V | |
| 9340 | 282 | } | |
| 9341 | 72192 | } | |
| 9342 | |||
| 9343 |
2/2✓ Branch 0 taken 50176 times.
✓ Branch 1 taken 72192 times.
|
122368 | if( s_version < 46 ) |
| 9344 | { | ||
| 9345 |
2/2✓ Branch 0 taken 71913 times.
✓ Branch 1 taken 279 times.
|
72192 | if(tempitem.family == itype_raft) |
| 9346 | { | ||
| 9347 | 279 | tempitem.misc1 = 1; //Rafting speed modifier; default 1. Negative slows, positive speeds. | |
| 9348 | 279 | } | |
| 9349 | 72192 | } | |
| 9350 |
2/2✓ Branch 0 taken 50176 times.
✓ Branch 1 taken 72192 times.
|
122368 | if ( s_version < 34 ) //! set the default counter for older quests. |
| 9351 | { | ||
| 9352 |
2/2✓ Branch 0 taken 116 times.
✓ Branch 1 taken 72076 times.
|
72192 | if ( (tempitem.flags & item_rupee_magic) ) |
| 9353 | { | ||
| 9354 | 116 | tempitem.cost_counter[0] = 1; | |
| 9355 | 116 | } | |
| 9356 | else | ||
| 9357 | { | ||
| 9358 |
2/2✓ Branch 0 taken 42496 times.
✓ Branch 1 taken 29580 times.
|
72076 | if(get_qr(qr_ENABLEMAGIC)) |
| 9359 | 42496 | tempitem.cost_counter[0] = 4; | |
| 9360 | else | ||
| 9361 | { | ||
| 9362 | 29580 | tempitem.cost_amount[0] = 0; | |
| 9363 | 29580 | tempitem.cost_counter[0] = -1; | |
| 9364 | } | ||
| 9365 | } | ||
| 9366 | 72192 | } | |
| 9367 | |||
| 9368 |
2/2✓ Branch 0 taken 50176 times.
✓ Branch 1 taken 72192 times.
|
122368 | if ( s_version < 35 ) //new Lens of Truth flags |
| 9369 | { | ||
| 9370 |
2/2✓ Branch 0 taken 71937 times.
✓ Branch 1 taken 255 times.
|
72192 | if ( tempitem.family == itype_lens ) |
| 9371 | { | ||
| 9372 |
2/2✓ Branch 0 taken 245 times.
✓ Branch 1 taken 10 times.
|
255 | if ( get_qr(qr_RAFTLENS) ) |
| 9373 | { | ||
| 9374 | 10 | tempitem.flags |= item_flag4; | |
| 9375 | 10 | } | |
| 9376 |
2/2✓ Branch 0 taken 89 times.
✓ Branch 1 taken 166 times.
|
255 | if ( get_qr(qr_LENSHINTS) ) |
| 9377 | { | ||
| 9378 | 166 | tempitem.flags |= item_flag1; | |
| 9379 | 166 | } | |
| 9380 |
2/2✓ Branch 0 taken 242 times.
✓ Branch 1 taken 13 times.
|
255 | if ( get_qr(qr_LENSSEESENEMIES) ) |
| 9381 | { | ||
| 9382 | 13 | tempitem.flags |= item_flag5; | |
| 9383 | 13 | } | |
| 9384 | 255 | } | |
| 9385 | 72192 | } | |
| 9386 |
2/2✓ Branch 0 taken 50176 times.
✓ Branch 1 taken 72192 times.
|
122368 | if ( s_version < 44 ) //InitD Labels and Sprite Script Data |
| 9387 | { | ||
| 9388 |
2/2✓ Branch 0 taken 577536 times.
✓ Branch 1 taken 72192 times.
|
649728 | for ( int32_t q = 0; q < 8; q++ ) |
| 9389 | { | ||
| 9390 | 577536 | sprintf(tempitem.initD_label[q],"InitD[%d]",q); | |
| 9391 | 577536 | sprintf(tempitem.sprite_initD_label[q],"InitD[%d]",q); | |
| 9392 | 577536 | tempitem.sprite_initiald[q] = 0; | |
| 9393 | 577536 | } | |
| 9394 | 72192 | tempitem.sprite_script = 0; | |
| 9395 | 72192 | } | |
| 9396 |
2/2✓ Branch 0 taken 50176 times.
✓ Branch 1 taken 72192 times.
|
122368 | if ( s_version < 47 ) //InitD Labels and Sprite Script Data |
| 9397 | { | ||
| 9398 | 72192 | tempitem.pickupflag = 0; | |
| 9399 | 72192 | } | |
| 9400 | |||
| 9401 |
2/2✓ Branch 0 taken 50176 times.
✓ Branch 1 taken 72192 times.
|
122368 | if( s_version < 51 ) |
| 9402 | { | ||
| 9403 |
2/2✓ Branch 0 taken 71592 times.
✓ Branch 1 taken 600 times.
|
72192 | if( tempitem.family == itype_candle ) |
| 9404 | { | ||
| 9405 | 600 | tempitem.misc4 = 50; //Step speed | |
| 9406 | 600 | } | |
| 9407 | 72192 | } | |
| 9408 | |||
| 9409 |
2/2✓ Branch 0 taken 50176 times.
✓ Branch 1 taken 72192 times.
|
122368 | if( s_version < 52 ) |
| 9410 | { | ||
| 9411 |
2/2✓ Branch 0 taken 71334 times.
✓ Branch 1 taken 858 times.
|
72192 | if( tempitem.family == itype_shield ) |
| 9412 | 858 | tempitem.flags |= item_flag1; //'Block Front' flag | |
| 9413 | 72192 | } | |
| 9414 |
2/2✓ Branch 0 taken 50176 times.
✓ Branch 1 taken 72192 times.
|
122368 | if(s_version < 53) |
| 9415 | { | ||
| 9416 |
4/4✓ Branch 0 taken 295 times.
✓ Branch 1 taken 70785 times.
✓ Branch 2 taken 831 times.
✓ Branch 3 taken 281 times.
|
72192 | switch(tempitem.family) |
| 9417 | { | ||
| 9418 | case itype_arrow: | ||
| 9419 | 831 | tempitem.cost_counter[1] = crARROWS; | |
| 9420 | 831 | tempitem.cost_amount[1] = 1; | |
| 9421 | 831 | break; | |
| 9422 | case itype_bomb: | ||
| 9423 | 295 | tempitem.cost_counter[1] = crBOMBS; | |
| 9424 | 295 | tempitem.cost_amount[1] = 1; | |
| 9425 | 295 | break; | |
| 9426 | case itype_sbomb: | ||
| 9427 | 281 | tempitem.cost_counter[1] = crSBOMBS; | |
| 9428 | 281 | tempitem.cost_amount[1] = 1; | |
| 9429 | 281 | break; | |
| 9430 | default: | ||
| 9431 | 70785 | tempitem.cost_counter[1] = crNONE; | |
| 9432 | 70785 | tempitem.cost_amount[1] = 0; | |
| 9433 | 70785 | } | |
| 9434 | 72192 | tempitem.magiccosttimer[1] = 0; | |
| 9435 | 72192 | } | |
| 9436 |
2/2✓ Branch 0 taken 47616 times.
✓ Branch 1 taken 74752 times.
|
122368 | if( s_version < 54 ) |
| 9437 | { | ||
| 9438 |
2/2✓ Branch 0 taken 74458 times.
✓ Branch 1 taken 294 times.
|
74752 | if( tempitem.family == itype_flippers ) |
| 9439 | 294 | tempitem.misc3 = INT_BTN_A; //'Block Front' flag | |
| 9440 | 74752 | } | |
| 9441 |
2/2✓ Branch 0 taken 47616 times.
✓ Branch 1 taken 74752 times.
|
122368 | if(s_version < 55) |
| 9442 | { | ||
| 9443 |
3/3✓ Branch 0 taken 578 times.
✓ Branch 1 taken 578 times.
✓ Branch 2 taken 73596 times.
|
74752 | switch(tempitem.family) |
| 9444 | { | ||
| 9445 | case itype_spinscroll: | ||
| 9446 | case itype_quakescroll: | ||
| 9447 | 578 | tempitem.usesound2 = WAV_ZN1CHARGE; | |
| 9448 | 578 | break; | |
| 9449 | case itype_spinscroll2: | ||
| 9450 | case itype_quakescroll2: | ||
| 9451 | 578 | tempitem.usesound2 = WAV_ZN1CHARGE2; | |
| 9452 | 578 | break; | |
| 9453 | } | ||
| 9454 | 74752 | } | |
| 9455 |
2/2✓ Branch 0 taken 47616 times.
✓ Branch 1 taken 74752 times.
|
122368 | if(s_version < 56) |
| 9456 | { | ||
| 9457 |
4/4✓ Branch 0 taken 73534 times.
✓ Branch 1 taken 289 times.
✓ Branch 2 taken 624 times.
✓ Branch 3 taken 305 times.
|
74752 | switch(tempitem.family) |
| 9458 | { | ||
| 9459 | case itype_divinefire: | ||
| 9460 |
2/2✓ Branch 0 taken 279 times.
✓ Branch 1 taken 10 times.
|
289 | SETFLAG(tempitem.flags, item_flag9, version < 0x255); //Strong Fire |
| 9461 |
2/2✓ Branch 0 taken 82 times.
✓ Branch 1 taken 207 times.
|
289 | SETFLAG(tempitem.flags, item_flag10, version < 0x250); //Magic Fire |
| 9462 | 289 | tempitem.flags |= item_flag11; //Divine Fire | |
| 9463 | 289 | break; | |
| 9464 | case itype_candle: | ||
| 9465 |
2/2✓ Branch 0 taken 311 times.
✓ Branch 1 taken 313 times.
|
624 | SETFLAG(tempitem.flags, item_flag9, tempitem.fam_type > 1); //Strong Fire |
| 9466 | 624 | tempitem.flags &= ~item_flag10; //Magic Fire | |
| 9467 | 624 | tempitem.flags &= ~item_flag11; //Divine Fire | |
| 9468 | 624 | break; | |
| 9469 | case itype_book: | ||
| 9470 | 305 | tempitem.flags |= item_flag9; //Strong Fire | |
| 9471 | 305 | tempitem.flags |= item_flag10; //Magic Fire | |
| 9472 | 305 | tempitem.flags &= ~item_flag11; //Divine Fire | |
| 9473 | 305 | break; | |
| 9474 | } | ||
| 9475 | 74752 | } | |
| 9476 |
2/2✓ Branch 0 taken 34048 times.
✓ Branch 1 taken 88320 times.
|
122368 | if (s_version < 61) |
| 9477 | { | ||
| 9478 |
2/2✓ Branch 0 taken 69537 times.
✓ Branch 1 taken 18783 times.
|
88320 | switch (tempitem.family) |
| 9479 | { | ||
| 9480 | case itype_sword: | ||
| 9481 | 18783 | tempitem.usesound2 = WAV_BEAM; | |
| 9482 | 18783 | break; | |
| 9483 | } | ||
| 9484 | 88320 | } | |
| 9485 | |||
| 9486 | |||
| 9487 |
2/2✓ Branch 0 taken 111380 times.
✓ Branch 1 taken 10988 times.
|
122368 | if(tempitem.fam_type==0) // Always do this |
| 9488 | 10988 | tempitem.fam_type=1; | |
| 9489 | |||
| 9490 | 122368 | itemsbuf[i] = tempitem; | |
| 9491 | 122368 | } | |
| 9492 | |||
| 9493 | 478 | return 0; | |
| 9494 | 479 | } | |
| 9495 | |||
| 9496 | static bool did_init_def_items = false; | ||
| 9497 | 244602 | void init_def_items() | |
| 9498 | { | ||
| 9499 |
2/2✓ Branch 0 taken 244233 times.
✓ Branch 1 taken 369 times.
|
244602 | if(did_init_def_items) return; |
| 9500 | 369 | did_init_def_items = true; | |
| 9501 | 369 | default_items[3].cost_counter[1] = crBOMBS; | |
| 9502 | 369 | default_items[13].cost_counter[1] = crARROWS; | |
| 9503 | 369 | default_items[14].cost_counter[1] = crARROWS; | |
| 9504 | 369 | default_items[48].cost_counter[1] = crSBOMBS; | |
| 9505 | 369 | default_items[57].cost_counter[1] = crARROWS; | |
| 9506 | 244602 | } | |
| 9507 | 244602 | void reset_itembuf(itemdata *item, int32_t id) | |
| 9508 | { | ||
| 9509 | 244602 | init_def_items(); | |
| 9510 |
2/2✓ Branch 0 taken 102717 times.
✓ Branch 1 taken 141885 times.
|
244602 | if(id<iLast) |
| 9511 | { | ||
| 9512 | // Copy everything *EXCEPT* the tile, misc, cset, frames, speed, delay and ltm. | ||
| 9513 | 141885 | word tile = item->tile; | |
| 9514 | 141885 | byte miscs = item->misc_flags, cset = item->csets, frames = item->frames, speed = item->speed, delay = item->delay; | |
| 9515 | 141885 | int32_t ltm = item->ltm; | |
| 9516 | |||
| 9517 | 141885 | *item = default_items[id]; | |
| 9518 | 141885 | item->tile = tile; | |
| 9519 | 141885 | item->misc_flags = miscs; | |
| 9520 | 141885 | item->csets = cset; | |
| 9521 | 141885 | item->frames = frames; | |
| 9522 | 141885 | item->speed = speed; | |
| 9523 | 141885 | item->delay = delay; | |
| 9524 | 141885 | item->ltm = ltm; | |
| 9525 | 141885 | } | |
| 9526 | 244602 | } | |
| 9527 | |||
| 9528 | 101120 | void reset_itemname(int32_t id) | |
| 9529 | { | ||
| 9530 | 101120 | sprintf(item_string[id],"zz%03d",id); | |
| 9531 | |||
| 9532 |
2/2✓ Branch 0 taken 44635 times.
✓ Branch 1 taken 56485 times.
|
101120 | if(id < iLast) |
| 9533 | 56485 | strcpy(item_string[id],old_item_string[id]); | |
| 9534 | 101120 | } | |
| 9535 | |||
| 9536 | 479 | int32_t readweapons(PACKFILE *f, zquestheader *Header) | |
| 9537 | { | ||
| 9538 |
2/2✓ Branch 0 taken 455 times.
✓ Branch 1 taken 24 times.
|
479 | bool should_skip = legacy_skip_flags && get_bit(legacy_skip_flags, skip_weapons); |
| 9539 | |||
| 9540 | 479 | word weapons_to_read=MAXWPNS; | |
| 9541 | int32_t dummy; | ||
| 9542 | byte padding; | ||
| 9543 | wpndata tempweapon; | ||
| 9544 | 479 | word s_version=0; | |
| 9545 | |||
| 9546 | |||
| 9547 |
2/2✓ Branch 0 taken 473 times.
✓ Branch 1 taken 6 times.
|
479 | if(Header->zelda_version < 0x186) |
| 9548 | { | ||
| 9549 | 6 | weapons_to_read=64; | |
| 9550 | 6 | } | |
| 9551 | |||
| 9552 |
2/2✓ Branch 0 taken 473 times.
✓ Branch 1 taken 6 times.
|
479 | if(Header->zelda_version < 0x185) |
| 9553 | { | ||
| 9554 | 6 | weapons_to_read=32; | |
| 9555 | 6 | } | |
| 9556 | |||
| 9557 |
2/2✓ Branch 0 taken 24 times.
✓ Branch 1 taken 455 times.
|
479 | if(Header->zelda_version > 0x192) |
| 9558 | { | ||
| 9559 | 455 | weapons_to_read=0; | |
| 9560 | |||
| 9561 | //section version info | ||
| 9562 |
1/2✓ Branch 0 taken 455 times.
✗ Branch 1 not taken.
|
455 | if(!p_igetw(&s_version,f)) |
| 9563 | { | ||
| 9564 | ✗ | return qe_invalid; | |
| 9565 | } | ||
| 9566 | |||
| 9567 | 455 | FFCore.quest_format[vWeaponSprites] = s_version; | |
| 9568 | |||
| 9569 |
1/2✓ Branch 0 taken 455 times.
✗ Branch 1 not taken.
|
455 | if(!read_deprecated_section_cversion(f)) |
| 9570 | { | ||
| 9571 | ✗ | return qe_invalid; | |
| 9572 | } | ||
| 9573 | |||
| 9574 | //section size | ||
| 9575 |
1/2✓ Branch 0 taken 455 times.
✗ Branch 1 not taken.
|
455 | if(!p_igetl(&dummy,f)) |
| 9576 | { | ||
| 9577 | ✗ | return qe_invalid; | |
| 9578 | } | ||
| 9579 | |||
| 9580 | //finally... section data | ||
| 9581 |
1/2✓ Branch 0 taken 455 times.
✗ Branch 1 not taken.
|
455 | if(!p_igetw(&weapons_to_read,f)) |
| 9582 | { | ||
| 9583 | ✗ | return qe_invalid; | |
| 9584 | } | ||
| 9585 | |||
| 9586 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 455 times.
|
455 | if (weapons_to_read > MAXWPNS) |
| 9587 | { | ||
| 9588 | ✗ | return qe_invalid; | |
| 9589 | } | ||
| 9590 | 455 | } | |
| 9591 | |||
| 9592 |
2/2✓ Branch 0 taken 396 times.
✓ Branch 1 taken 83 times.
|
479 | if(s_version>2) |
| 9593 | { | ||
| 9594 |
2/2✓ Branch 0 taken 101376 times.
✓ Branch 1 taken 396 times.
|
101772 | for(int32_t i=0; i<weapons_to_read; i++) |
| 9595 | { | ||
| 9596 | char tempname[64]; | ||
| 9597 | |||
| 9598 |
1/2✓ Branch 0 taken 101376 times.
✗ Branch 1 not taken.
|
101376 | if(!pfread(tempname, 64, f)) |
| 9599 | { | ||
| 9600 | ✗ | return qe_invalid; | |
| 9601 | } | ||
| 9602 | |||
| 9603 | 101376 | weapon_string[i][0] = '\0'; | |
| 9604 | 101376 | strncat(weapon_string[i], tempname, 64 - 1); | |
| 9605 | 101376 | } | |
| 9606 | |||
| 9607 |
1/2✓ Branch 0 taken 396 times.
✗ Branch 1 not taken.
|
396 | if(s_version<4) |
| 9608 | { | ||
| 9609 | ✗ | strcpy(weapon_string[iwHover],old_weapon_string[iwHover]); | |
| 9610 | ✗ | strcpy(weapon_string[wFIREMAGIC],old_weapon_string[wFIREMAGIC]); | |
| 9611 | ✗ | } | |
| 9612 | |||
| 9613 |
1/2✓ Branch 0 taken 396 times.
✗ Branch 1 not taken.
|
396 | if(s_version<5) |
| 9614 | { | ||
| 9615 | ✗ | strcpy(weapon_string[iwQuarterHearts],old_weapon_string[iwQuarterHearts]); | |
| 9616 | ✗ | } | |
| 9617 | |||
| 9618 | /* | ||
| 9619 | if (s_version<6) | ||
| 9620 | { | ||
| 9621 | strcpy(weapon_string[iwSideRaft],old_weapon_string[iwSideRaft]); | ||
| 9622 | strcpy(weapon_string[iwSideLadder],old_weapon_string[iwSideLadder]); | ||
| 9623 | } | ||
| 9624 | */ | ||
| 9625 | 396 | } | |
| 9626 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 82 times.
|
83 | else if (!should_skip) |
| 9627 | { | ||
| 9628 |
2/2✓ Branch 0 taken 20992 times.
✓ Branch 1 taken 82 times.
|
21074 | for(int32_t i=0; i<MAXWPNS; i++) |
| 9629 | 20992 | reset_weaponname(i); | |
| 9630 | 82 | } | |
| 9631 | |||
| 9632 |
2/2✓ Branch 0 taken 110188 times.
✓ Branch 1 taken 479 times.
|
110667 | for(int32_t i=0; i<weapons_to_read; i++) |
| 9633 | { | ||
| 9634 | 110188 | word oldtile = 0; | |
| 9635 |
2/2✓ Branch 0 taken 49152 times.
✓ Branch 1 taken 61036 times.
|
110188 | if (s_version < 8) |
| 9636 | { | ||
| 9637 |
1/2✓ Branch 0 taken 61036 times.
✗ Branch 1 not taken.
|
61036 | if (!p_igetw(&oldtile, f)) |
| 9638 | ✗ | return qe_invalid; | |
| 9639 | 61036 | } | |
| 9640 | |||
| 9641 |
1/2✓ Branch 0 taken 110188 times.
✗ Branch 1 not taken.
|
110188 | if(!p_getc(&tempweapon.misc,f)) |
| 9642 | { | ||
| 9643 | ✗ | return qe_invalid; | |
| 9644 | } | ||
| 9645 | |||
| 9646 |
1/2✓ Branch 0 taken 110188 times.
✗ Branch 1 not taken.
|
110188 | if(!p_getc(&tempweapon.csets,f)) |
| 9647 | { | ||
| 9648 | ✗ | return qe_invalid; | |
| 9649 | } | ||
| 9650 | |||
| 9651 |
1/2✓ Branch 0 taken 110188 times.
✗ Branch 1 not taken.
|
110188 | if(!p_getc(&tempweapon.frames,f)) |
| 9652 | { | ||
| 9653 | ✗ | return qe_invalid; | |
| 9654 | } | ||
| 9655 | |||
| 9656 |
1/2✓ Branch 0 taken 110188 times.
✗ Branch 1 not taken.
|
110188 | if(!p_getc(&tempweapon.speed,f)) |
| 9657 | { | ||
| 9658 | ✗ | return qe_invalid; | |
| 9659 | } | ||
| 9660 | |||
| 9661 |
1/2✓ Branch 0 taken 110188 times.
✗ Branch 1 not taken.
|
110188 | if(!p_getc(&tempweapon.type,f)) |
| 9662 | { | ||
| 9663 | ✗ | return qe_invalid; | |
| 9664 | } | ||
| 9665 | |||
| 9666 |
2/2✓ Branch 0 taken 60012 times.
✓ Branch 1 taken 50176 times.
|
110188 | if ( s_version >= 7 ) |
| 9667 | { | ||
| 9668 |
1/2✓ Branch 0 taken 50176 times.
✗ Branch 1 not taken.
|
50176 | if(!p_igetw(&tempweapon.script,f)) |
| 9669 | { | ||
| 9670 | ✗ | return qe_invalid; | |
| 9671 | } | ||
| 9672 |
1/2✓ Branch 0 taken 50176 times.
✗ Branch 1 not taken.
|
50176 | if(!p_igetl(&tempweapon.tile,f)) |
| 9673 | { | ||
| 9674 | ✗ | return qe_invalid; | |
| 9675 | } | ||
| 9676 | 50176 | } | |
| 9677 |
2/2✓ Branch 0 taken 50176 times.
✓ Branch 1 taken 60012 times.
|
110188 | if ( s_version < 7 ) |
| 9678 | { | ||
| 9679 | 60012 | tempweapon.tile = oldtile; | |
| 9680 | 60012 | } | |
| 9681 | |||
| 9682 |
2/2✓ Branch 0 taken 105388 times.
✓ Branch 1 taken 4800 times.
|
110188 | if(Header->zelda_version < 0x193) |
| 9683 | { | ||
| 9684 |
1/2✓ Branch 0 taken 4800 times.
✗ Branch 1 not taken.
|
4800 | if(!p_getc(&padding,f)) |
| 9685 | { | ||
| 9686 | ✗ | return qe_invalid; | |
| 9687 | } | ||
| 9688 | 4800 | } | |
| 9689 | |||
| 9690 |
2/2✓ Branch 0 taken 101376 times.
✓ Branch 1 taken 8812 times.
|
110188 | if(s_version < 6) |
| 9691 | { | ||
| 9692 |
2/2✓ Branch 0 taken 18 times.
✓ Branch 1 taken 8794 times.
|
8812 | if(i==ewFIRETRAIL) |
| 9693 | { | ||
| 9694 | 18 | tempweapon.misc |= WF_BEHIND; | |
| 9695 | 18 | } | |
| 9696 | else | ||
| 9697 | 8794 | tempweapon.misc &= ~WF_BEHIND; | |
| 9698 | 8812 | } | |
| 9699 | |||
| 9700 |
2/2✓ Branch 0 taken 256 times.
✓ Branch 1 taken 109932 times.
|
110188 | if (!should_skip) |
| 9701 | 109932 | memcpy(&wpnsbuf[i], &tempweapon, sizeof(tempweapon)); | |
| 9702 | 110188 | } | |
| 9703 | |||
| 9704 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 478 times.
|
479 | if (should_skip) |
| 9705 | 1 | return 0; | |
| 9706 | |||
| 9707 |
2/2✓ Branch 0 taken 82 times.
✓ Branch 1 taken 396 times.
|
478 | if(s_version<2) |
| 9708 | { | ||
| 9709 | 82 | wpnsbuf[wSBOOM]=wpnsbuf[wBOOM]; | |
| 9710 | 82 | } | |
| 9711 | |||
| 9712 |
2/2✓ Branch 0 taken 82 times.
✓ Branch 1 taken 396 times.
|
478 | if(s_version<5) |
| 9713 | { | ||
| 9714 | 82 | wpnsbuf[iwQuarterHearts].tile=1; | |
| 9715 | 82 | wpnsbuf[iwQuarterHearts].csets=1; | |
| 9716 | 82 | } | |
| 9717 | |||
| 9718 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 478 times.
|
478 | if(Header->zelda_version < 0x176) |
| 9719 | { | ||
| 9720 | ✗ | wpnsbuf[iwSpawn] = *((wpndata*)(itemsbuf + iMisc1)); | |
| 9721 | ✗ | wpnsbuf[iwDeath] = *((wpndata*)(itemsbuf + iMisc2)); | |
| 9722 | ✗ | itemsbuf[iMisc1].clear(); | |
| 9723 | ✗ | itemsbuf[iMisc2].clear(); | |
| 9724 | ✗ | } | |
| 9725 | |||
| 9726 |
3/4✓ Branch 0 taken 460 times.
✓ Branch 1 taken 18 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 5 times.
|
483 | if((Header->zelda_version < 0x192)|| |
| 9727 |
2/2✓ Branch 0 taken 5 times.
✓ Branch 1 taken 455 times.
|
460 | ((Header->zelda_version == 0x192)&&(Header->build<129))) |
| 9728 | { | ||
| 9729 | 18 | wpnsbuf[wHSCHAIN_V] = wpnsbuf[wHSCHAIN_H]; | |
| 9730 | 18 | } | |
| 9731 | |||
| 9732 |
2/2✓ Branch 0 taken 23 times.
✓ Branch 1 taken 455 times.
|
478 | if((Header->zelda_version < 0x210)) |
| 9733 | { | ||
| 9734 | 23 | wpnsbuf[wLSHEAD] = wpnsbuf[wHSHEAD]; | |
| 9735 | 23 | wpnsbuf[wLSCHAIN_H] = wpnsbuf[wHSCHAIN_H]; | |
| 9736 | 23 | wpnsbuf[wLSHANDLE] = wpnsbuf[wHSHANDLE]; | |
| 9737 | 23 | wpnsbuf[wLSCHAIN_V] = wpnsbuf[wHSCHAIN_V]; | |
| 9738 | 23 | } | |
| 9739 | |||
| 9740 | 478 | return 0; | |
| 9741 | 479 | } | |
| 9742 | |||
| 9743 | 220284 | static void guy_update_firesfx(guydata& tempguy) | |
| 9744 | { | ||
| 9745 | 220284 | tempguy.firesfx = 0; | |
| 9746 |
2/2✓ Branch 0 taken 6394 times.
✓ Branch 1 taken 213890 times.
|
220284 | if (tempguy.family == eeWIZZ) |
| 9747 | { | ||
| 9748 |
4/5✗ Branch 0 not taken.
✓ Branch 1 taken 968 times.
✓ Branch 2 taken 3908 times.
✓ Branch 3 taken 823 times.
✓ Branch 4 taken 695 times.
|
6394 | switch (tempguy.attributes[1]) |
| 9749 | { | ||
| 9750 | case 0: // normal weapon | ||
| 9751 | 3908 | tempguy.firesfx = WAV_WAND; | |
| 9752 | 3908 | break; | |
| 9753 | case 1: // 8 shots | ||
| 9754 |
2/2✓ Branch 0 taken 82 times.
✓ Branch 1 taken 741 times.
|
823 | if (get_qr(qr_8WAY_SHOT_SFX_DEP)) tempguy.firesfx = WAV_FIRE; |
| 9755 | else | ||
| 9756 | { | ||
| 9757 |
3/8✓ Branch 0 taken 637 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 88 times.
✓ Branch 3 taken 16 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
741 | switch (tempguy.weapon) |
| 9758 | { | ||
| 9759 | case ewFireTrail: | ||
| 9760 | case ewFlame: | ||
| 9761 | case ewFlame2Trail: | ||
| 9762 | case ewFlame2: | ||
| 9763 | 637 | tempguy.firesfx = WAV_FIRE; | |
| 9764 | 637 | break; | |
| 9765 | case ewWind: | ||
| 9766 | case ewMagic: | ||
| 9767 | 88 | tempguy.firesfx = WAV_WAND; | |
| 9768 | 88 | break; | |
| 9769 | case ewIce: | ||
| 9770 | ✗ | tempguy.firesfx = WAV_ZN1ICE; | |
| 9771 | ✗ | break; | |
| 9772 | case ewRock: | ||
| 9773 | ✗ | tempguy.firesfx = WAV_ZN1ROCK; | |
| 9774 | ✗ | break; | |
| 9775 | case ewFireball2: | ||
| 9776 | case ewFireball: | ||
| 9777 | 16 | tempguy.firesfx = WAV_ZN1FIREBALL; | |
| 9778 | 16 | break; | |
| 9779 | case ewBrang: | ||
| 9780 | ✗ | tempguy.firesfx = WAV_BRANG; | |
| 9781 | ✗ | break; | |
| 9782 | case ewBomb:case ewSBomb: case ewLitBomb:case ewLitSBomb: | ||
| 9783 | ✗ | tempguy.firesfx = WAV_BOMB; | |
| 9784 | ✗ | break; | |
| 9785 | default: | ||
| 9786 | ✗ | tempguy.firesfx = 0; | |
| 9787 | ✗ | break; | |
| 9788 | } | ||
| 9789 | 741 | break; | |
| 9790 | } | ||
| 9791 | case 2: // Summon | ||
| 9792 | 1050 | tempguy.firesfx = WAV_FIRE; | |
| 9793 | 1050 | break; | |
| 9794 | case 3: // Summon Layer | ||
| 9795 | 695 | tempguy.firesfx = get_qr(qr_MORESOUNDS) ? WAV_ZN1SUMMON : WAV_FIRE; | |
| 9796 | 695 | break; | |
| 9797 | } | ||
| 9798 | 6394 | } | |
| 9799 | else | ||
| 9800 | { | ||
| 9801 |
6/6✓ Branch 0 taken 161475 times.
✓ Branch 1 taken 52415 times.
✓ Branch 2 taken 41661 times.
✓ Branch 3 taken 203136 times.
✓ Branch 4 taken 47040 times.
✓ Branch 5 taken 47036 times.
|
213890 | if ((tempguy.family == eeWALK || tempguy.family == eePROJECTILE) && (tempguy.attributes[0] == e1tSUMMON || tempguy.attributes[0] == e1tSUMMONLAYER)) |
| 9802 | { | ||
| 9803 | 94076 | tempguy.firesfx = get_qr(qr_MORESOUNDS) ? WAV_ZN1SUMMON : WAV_FIRE; | |
| 9804 | 94076 | } | |
| 9805 | else | ||
| 9806 | { | ||
| 9807 |
7/8✓ Branch 0 taken 9552 times.
✓ Branch 1 taken 2340 times.
✓ Branch 2 taken 1787 times.
✓ Branch 3 taken 12743 times.
✓ Branch 4 taken 170527 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 3936 times.
✓ Branch 7 taken 2251 times.
|
203136 | switch (tempguy.weapon) |
| 9808 | { | ||
| 9809 | case ewFireTrail: | ||
| 9810 | case ewFlame: | ||
| 9811 | case ewFlame2Trail: | ||
| 9812 | case ewFlame2: | ||
| 9813 | 9552 | tempguy.firesfx = WAV_FIRE; | |
| 9814 | 9552 | break; | |
| 9815 | case ewWind: | ||
| 9816 | case ewMagic: | ||
| 9817 | 1787 | tempguy.firesfx = WAV_WAND; | |
| 9818 | 1787 | break; | |
| 9819 | case ewIce: | ||
| 9820 | ✗ | tempguy.firesfx = WAV_ZN1ICE; | |
| 9821 | ✗ | break; | |
| 9822 | case ewRock: | ||
| 9823 | 3936 | tempguy.firesfx = WAV_ZN1ROCK; | |
| 9824 | 3936 | break; | |
| 9825 | case ewFireball2: | ||
| 9826 | case ewFireball: | ||
| 9827 | 12743 | tempguy.firesfx = WAV_ZN1FIREBALL; | |
| 9828 | 12743 | break; | |
| 9829 | case ewBrang: | ||
| 9830 | 2251 | tempguy.firesfx = WAV_BRANG; | |
| 9831 | 2251 | break; | |
| 9832 | case ewBomb:case ewSBomb: case ewLitBomb:case ewLitSBomb: | ||
| 9833 | 2340 | tempguy.firesfx = WAV_BOMB; | |
| 9834 | 2340 | break; | |
| 9835 | default: | ||
| 9836 | 170527 | tempguy.firesfx = 0; | |
| 9837 | 170527 | break; | |
| 9838 | } | ||
| 9839 | } | ||
| 9840 | } | ||
| 9841 | 209534 | } | |
| 9842 | |||
| 9843 | 209534 | static void guy_update_weaponflags(guydata& tempguy) | |
| 9844 | { | ||
| 9845 | 209534 | tempguy.weap_data.unblockable = 0; | |
| 9846 | 209534 | tempguy.weap_data.moveflags = move_none; | |
| 9847 |
4/4✓ Branch 0 taken 203053 times.
✓ Branch 1 taken 6481 times.
✓ Branch 2 taken 2984 times.
✓ Branch 3 taken 200069 times.
|
209534 | if (tempguy.weapon == ewFlame || tempguy.weapon == ewFireTrail) |
| 9848 | 9465 | tempguy.weap_data.moveflags |= (move_obeys_grav | move_can_pitfall); | |
| 9849 | 209534 | tempguy.weap_data.override_flags = 0; | |
| 9850 | 209534 | tempguy.weap_data.hxofs = 0; | |
| 9851 | 209534 | tempguy.weap_data.hyofs = 0; | |
| 9852 | 209534 | tempguy.weap_data.hxsz = 0; | |
| 9853 | 209534 | tempguy.weap_data.hysz = 0; | |
| 9854 | 209534 | tempguy.weap_data.hzsz = 0; | |
| 9855 | 209534 | tempguy.weap_data.xofs = 0; | |
| 9856 | 209534 | tempguy.weap_data.yofs = 0; | |
| 9857 | 209534 | tempguy.weap_data.tilew = 0; | |
| 9858 | 209534 | tempguy.weap_data.tileh = 0; | |
| 9859 |
5/5✓ Branch 0 taken 2491 times.
✓ Branch 1 taken 168560 times.
✓ Branch 2 taken 18394 times.
✓ Branch 3 taken 12759 times.
✓ Branch 4 taken 7330 times.
|
209534 | switch (tempguy.weapon) |
| 9860 | { | ||
| 9861 | case ewFireball: case ewFireball2: | ||
| 9862 | 12759 | tempguy.weap_data.step = 1.75_zf; | |
| 9863 | 12759 | break; | |
| 9864 | case ewSword: case ewLitBomb: case ewLitSBomb: | ||
| 9865 | case ewRock: case ewMagic: case ewWind: | ||
| 9866 | 18394 | tempguy.weap_data.step = 3_zf; | |
| 9867 | 18394 | break; | |
| 9868 | case ewArrow: | ||
| 9869 | 2491 | tempguy.weap_data.step = 2_zf; | |
| 9870 | 2491 | break; | |
| 9871 | case ewFlame: case ewFlame2: | ||
| 9872 | 7330 | tempguy.weap_data.step = 1_zf; | |
| 9873 | 7330 | break; | |
| 9874 | default: | ||
| 9875 | 168560 | tempguy.weap_data.step = 0_zf; | |
| 9876 | 168560 | break; | |
| 9877 | } | ||
| 9878 |
2/2✓ Branch 0 taken 1047670 times.
✓ Branch 1 taken 209534 times.
|
1257204 | for (int q = 0; q < WPNSPR_MAX; ++q) |
| 9879 | { | ||
| 9880 | 1047670 | tempguy.weap_data.burnsprs[q] = 0; | |
| 9881 | 1047670 | tempguy.weap_data.light_rads[q] = 0; | |
| 9882 | 1047670 | } | |
| 9883 | 209534 | } | |
| 9884 | |||
| 9885 | 209534 | static void guy_update_weaponspecialsfx(guydata& tempguy) | |
| 9886 | { | ||
| 9887 |
3/3✓ Branch 0 taken 2251 times.
✓ Branch 1 taken 204888 times.
✓ Branch 2 taken 2395 times.
|
209534 | switch (tempguy.weapon) |
| 9888 | { | ||
| 9889 | case ewBrang: | ||
| 9890 | 2251 | tempguy.specialsfx = WAV_BRANG; | |
| 9891 | 2251 | break; | |
| 9892 | case ewBomb: case ewSBomb: case ewLitBomb:case ewLitSBomb: | ||
| 9893 | 2395 | tempguy.specialsfx = WAV_BOMB; | |
| 9894 | 2395 | break; | |
| 9895 | default: | ||
| 9896 | 204888 | tempguy.specialsfx = 0; | |
| 9897 | 204888 | break; | |
| 9898 | } | ||
| 9899 | 209534 | } | |
| 9900 | |||
| 9901 | 478 | void init_guys(int32_t guyversion) | |
| 9902 | { | ||
| 9903 |
2/2✓ Branch 0 taken 244736 times.
✓ Branch 1 taken 478 times.
|
245214 | for(int32_t i=0; i<MAXGUYS; i++) |
| 9904 | { | ||
| 9905 | 244736 | guysbuf[i] = default_guys[0]; | |
| 9906 | 244736 | } | |
| 9907 | |||
| 9908 |
2/2✓ Branch 0 taken 84606 times.
✓ Branch 1 taken 478 times.
|
85084 | for(int32_t i=0; i<OLDMAXGUYS; i++) |
| 9909 | { | ||
| 9910 | 84606 | guysbuf[i] = default_guys[i]; | |
| 9911 |
2/2✓ Branch 0 taken 83650 times.
✓ Branch 1 taken 956 times.
|
84606 | guysbuf[i].spr_shadow = (guysbuf[i].family==eeROCK && guysbuf[i].attributes[9] == 1) ? iwLargeShadow : iwShadow; |
| 9912 | 84606 | guysbuf[i].spr_death = iwDeath; | |
| 9913 | 84606 | guysbuf[i].spr_spawn = iwSpawn; | |
| 9914 | // Patra fix: 2.10 BSPatras used spDIG. 2.50 Patras use CSet 7. | ||
| 9915 |
4/4✓ Branch 0 taken 14514 times.
✓ Branch 1 taken 70092 times.
✓ Branch 2 taken 14432 times.
✓ Branch 3 taken 82 times.
|
84606 | if(guyversion<=3 && i==ePATRABS) |
| 9916 | { | ||
| 9917 | 82 | guysbuf[i].bosspal=spDIG; | |
| 9918 | 82 | guysbuf[i].cset=14; | |
| 9919 | 82 | guysbuf[i].attributes[8] = 14; | |
| 9920 | 82 | } | |
| 9921 | |||
| 9922 |
2/2✓ Branch 0 taken 70092 times.
✓ Branch 1 taken 14514 times.
|
84606 | if(guyversion<=3) |
| 9923 | { | ||
| 9924 | // Rope/Ghini Flash rules | ||
| 9925 |
2/2✓ Branch 0 taken 4071 times.
✓ Branch 1 taken 10443 times.
|
14514 | if(get_bit(deprecated_rules, qr_NOROPE2FLASH_DEP)) |
| 9926 | { | ||
| 9927 |
2/2✓ Branch 0 taken 10384 times.
✓ Branch 1 taken 59 times.
|
10443 | if(i==eROPE2) |
| 9928 | { | ||
| 9929 | 59 | guysbuf[i].flags &= ~guy_flashing; | |
| 9930 | 59 | } | |
| 9931 | 10443 | } | |
| 9932 | |||
| 9933 |
2/2✓ Branch 0 taken 12390 times.
✓ Branch 1 taken 2124 times.
|
14514 | if(get_bit(deprecated_rules, qr_NOBUBBLEFLASH_DEP)) |
| 9934 | { | ||
| 9935 |
12/12✓ Branch 0 taken 2112 times.
✓ Branch 1 taken 12 times.
✓ Branch 2 taken 2100 times.
✓ Branch 3 taken 12 times.
✓ Branch 4 taken 2088 times.
✓ Branch 5 taken 12 times.
✓ Branch 6 taken 2076 times.
✓ Branch 7 taken 12 times.
✓ Branch 8 taken 2064 times.
✓ Branch 9 taken 12 times.
✓ Branch 10 taken 12 times.
✓ Branch 11 taken 2052 times.
|
2124 | if(i==eBUBBLEST || i==eBUBBLESP || i==eBUBBLESR || i==eBUBBLEIT || i==eBUBBLEIP || i==eBUBBLEIR) |
| 9936 | { | ||
| 9937 | 72 | guysbuf[i].flags &= ~guy_flashing; | |
| 9938 | 72 | } | |
| 9939 | 2124 | } | |
| 9940 | |||
| 9941 |
2/2✓ Branch 0 taken 14432 times.
✓ Branch 1 taken 82 times.
|
14514 | if(i==eGHINI2) |
| 9942 | { | ||
| 9943 |
2/2✓ Branch 0 taken 78 times.
✓ Branch 1 taken 4 times.
|
82 | if(get_bit(deprecated_rules, qr_GHINI2BLINK_DEP)) |
| 9944 | { | ||
| 9945 | 4 | guysbuf[i].flags |= guy_blinking; | |
| 9946 | 4 | } | |
| 9947 | |||
| 9948 |
2/2✓ Branch 0 taken 44 times.
✓ Branch 1 taken 38 times.
|
82 | if(get_bit(deprecated_rules, qr_PHANTOMGHINI2_DEP)) |
| 9949 | { | ||
| 9950 | 38 | guysbuf[i].flags |= guy_transparent; | |
| 9951 | 38 | } | |
| 9952 | 82 | } | |
| 9953 | |||
| 9954 |
4/4✓ Branch 0 taken 14432 times.
✓ Branch 1 taken 82 times.
✓ Branch 2 taken 82 times.
✓ Branch 3 taken 14350 times.
|
14514 | if (i == eDIG1 || i == eDIG3) |
| 9955 | { | ||
| 9956 | 164 | guysbuf[i].flags |= guy_ignore_kill_all; | |
| 9957 | 164 | } | |
| 9958 | 14514 | } | |
| 9959 | |||
| 9960 | // Darknut fix | ||
| 9961 |
10/10✓ Branch 0 taken 84128 times.
✓ Branch 1 taken 478 times.
✓ Branch 2 taken 83650 times.
✓ Branch 3 taken 478 times.
✓ Branch 4 taken 83172 times.
✓ Branch 5 taken 478 times.
✓ Branch 6 taken 82694 times.
✓ Branch 7 taken 478 times.
✓ Branch 8 taken 478 times.
✓ Branch 9 taken 82216 times.
|
84606 | if(i==eDKNUT1 || i==eDKNUT2 || i==eDKNUT3 || i==eDKNUT4 || i==eDKNUT5) |
| 9962 | { | ||
| 9963 |
2/2✓ Branch 0 taken 1980 times.
✓ Branch 1 taken 410 times.
|
2390 | if(get_qr(qr_NEWENEMYTILES)) |
| 9964 | { | ||
| 9965 | 1980 | guysbuf[i].s_tile=guysbuf[i].e_tile+120; | |
| 9966 | 1980 | guysbuf[i].s_width=guysbuf[i].e_width; | |
| 9967 | 1980 | guysbuf[i].s_height=guysbuf[i].e_height; | |
| 9968 | 1980 | } | |
| 9969 | 410 | else guysbuf[i].s_tile=860; | |
| 9970 | |||
| 9971 |
2/2✓ Branch 0 taken 320 times.
✓ Branch 1 taken 2070 times.
|
2390 | if(!get_bit(deprecated_rules,qr_BRKBLSHLDS_DEP)) |
| 9972 | 2070 | guysbuf[i].flags &= ~guy_bkshield; | |
| 9973 | else | ||
| 9974 | 320 | guysbuf[i].flags |= guy_bkshield; | |
| 9975 | 2390 | } | |
| 9976 | |||
| 9977 |
4/4✓ Branch 0 taken 84128 times.
✓ Branch 1 taken 478 times.
✓ Branch 2 taken 84556 times.
✓ Branch 3 taken 50 times.
|
84606 | if((i==eGELTRIB || i==eFGELTRIB) && get_bit(deprecated_rules,qr_OLDTRIBBLES_DEP)) |
| 9978 | { | ||
| 9979 | 50 | guysbuf[i].attributes[2] = (i == eFGELTRIB ? eFZOL : eZOL); | |
| 9980 | 50 | } | |
| 9981 | |||
| 9982 | 84606 | guy_update_firesfx(guysbuf[i]); | |
| 9983 | 84606 | guy_update_weaponflags(guysbuf[i]); | |
| 9984 | 84606 | guy_update_weaponspecialsfx(guysbuf[i]); | |
| 9985 | 84606 | } | |
| 9986 | 478 | } | |
| 9987 | |||
| 9988 | 20992 | void reset_weaponname(int32_t i) | |
| 9989 | { | ||
| 9990 |
2/2✓ Branch 0 taken 7216 times.
✓ Branch 1 taken 13776 times.
|
20992 | if(i<wLast) |
| 9991 | { | ||
| 9992 | 7216 | strcpy(weapon_string[i],old_weapon_string[i]); | |
| 9993 | 7216 | } | |
| 9994 | else | ||
| 9995 | 13776 | sprintf(weapon_string[i],"zz%03d",i); | |
| 9996 | 20992 | } | |
| 9997 | |||
| 9998 | 478 | void init_item_drop_sets() | |
| 9999 | { | ||
| 10000 |
2/2✓ Branch 0 taken 122368 times.
✓ Branch 1 taken 478 times.
|
122846 | for(int32_t i=0; i<MAXITEMDROPSETS; i++) |
| 10001 | { | ||
| 10002 | // item_drop_sets[i] = default_item_drop_sets[0]; | ||
| 10003 | 122368 | memset(&item_drop_sets[i], 0, sizeof(item_drop_object)); | |
| 10004 | 122368 | } | |
| 10005 | |||
| 10006 |
2/2✓ Branch 0 taken 6214 times.
✓ Branch 1 taken 478 times.
|
6692 | for(int32_t i=0; i<isMAX; i++) |
| 10007 | { | ||
| 10008 | 6214 | item_drop_sets[i] = default_item_drop_sets[i]; | |
| 10009 | |||
| 10010 | // Deprecated: qr_NOCLOCKS and qr_ALLOW10RUPEEDROPS | ||
| 10011 |
2/2✓ Branch 0 taken 62140 times.
✓ Branch 1 taken 6214 times.
|
68354 | for(int32_t j=0; j<10; ++j) |
| 10012 | { | ||
| 10013 | 62140 | int32_t it = item_drop_sets[i].item[j]; | |
| 10014 | |||
| 10015 |
3/4✓ Branch 0 taken 43700 times.
✓ Branch 1 taken 18440 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 2820 times.
|
62140 | if((itemsbuf[it].family == itype_rupee && ((itemsbuf[it].amount)&0xFFF) == 10) |
| 10016 |
2/2✓ Branch 0 taken 2820 times.
✓ Branch 1 taken 40880 times.
|
43700 | && !get_bit(deprecated_rules, qr_ALLOW10RUPEEDROPS_DEP)) |
| 10017 | { | ||
| 10018 | 2820 | item_drop_sets[i].chance[j+1]=0; | |
| 10019 | 2820 | } | |
| 10020 |
4/4✓ Branch 0 taken 1912 times.
✓ Branch 1 taken 57408 times.
✓ Branch 2 taken 144 times.
✓ Branch 3 taken 1768 times.
|
59320 | else if(itemsbuf[it].family == itype_clock && get_bit(deprecated_rules, qr_NOCLOCKS_DEP)) |
| 10021 | { | ||
| 10022 | 144 | item_drop_sets[i].chance[j+1]=0; | |
| 10023 | 144 | } | |
| 10024 | |||
| 10025 | // From Sept 2007 to Dec 2008, non-gameplay items were prohibited. | ||
| 10026 |
2/2✓ Branch 0 taken 62124 times.
✓ Branch 1 taken 16 times.
|
62140 | if(itemsbuf[it].family == itype_misc) |
| 10027 | { | ||
| 10028 | // If a non-gameplay item was selected, then item drop was aborted. | ||
| 10029 | // Reflect this by increasing the 'Nothing' chance accordingly. | ||
| 10030 | 16 | item_drop_sets[i].chance[0]+=item_drop_sets[i].chance[j+1]; | |
| 10031 | 16 | item_drop_sets[i].chance[j+1]=0; | |
| 10032 | 16 | } | |
| 10033 | 62140 | } | |
| 10034 | 6214 | } | |
| 10035 | 478 | } | |
| 10036 | |||
| 10037 | 478 | void init_favorites() | |
| 10038 | { | ||
| 10039 |
2/2✓ Branch 0 taken 602280 times.
✓ Branch 1 taken 478 times.
|
602758 | for(int32_t i=0; i<MAXFAVORITECOMBOS; i++) |
| 10040 | { | ||
| 10041 | 602280 | favorite_combos[i]=-1; | |
| 10042 | 602280 | } | |
| 10043 | 478 | } | |
| 10044 | |||
| 10045 | const char *ctype_name[cMAX]= | ||
| 10046 | { | ||
| 10047 | "cNONE", "cSTAIR", "cCAVE", "cWATER", "cARMOS", "cGRAVE", "cDOCK", | ||
| 10048 | "cUNDEF", "cPUSH_WAIT", "cPUSH_HEAVY", "cPUSH_HW", "cL_STATUE", "cR_STATUE", | ||
| 10049 | "cWALKSLOW", "cCVUP", "cCVDOWN", "cCVLEFT", "cCVRIGHT", "cSWIMWARP", "cDIVEWARP", | ||
| 10050 | "cLADDERHOOKSHOT", "cTRIGNOFLAG", "cTRIGFLAG", "cZELDA", "cSLASH", "cSLASHITEM", | ||
| 10051 | "cPUSH_HEAVY2", "cPUSH_HW2", "cPOUND", "cHSGRAB", "cHSBRIDGE", "cDAMAGE1", | ||
| 10052 | "cDAMAGE2", "cDAMAGE3", "cDAMAGE4", "cC_STATUE", "cTRAP_H", "cTRAP_V", "cTRAP_4", | ||
| 10053 | "cTRAP_LR", "cTRAP_UD", "cPIT", "cHOOKSHOTONLY", "cOVERHEAD", "cNOFLYZONE", "cMIRROR", | ||
| 10054 | "cMIRRORSLASH", "cMIRRORBACKSLASH", "cMAGICPRISM", "cMAGICPRISM4", | ||
| 10055 | "cMAGICSPONGE", "cCAVE2", "cEYEBALL_A", "cEYEBALL_B", "cNOJUMPZONE", "cBUSH", | ||
| 10056 | "cFLOWERS", "cTALLGRASS", "cSHALLOWWATER", "cLOCKBLOCK", "cLOCKBLOCK2", | ||
| 10057 | "cBOSSLOCKBLOCK", "cBOSSLOCKBLOCK2", "cLADDERONLY", "cBSGRAVE", | ||
| 10058 | "cCHEST", "cCHEST2", "cLOCKEDCHEST", "cLOCKEDCHEST2", "cBOSSCHEST", "cBOSSCHEST2", | ||
| 10059 | "cRESET", "cSAVE", "cSAVE2", "cCAVEB", "cCAVEC", "cCAVED", | ||
| 10060 | "cSTAIRB", "cSTAIRC", "cSTAIRD", "cPITB", "cPITC", "cPITD", | ||
| 10061 | "cCAVE2B", "cCAVE2C", "cCAVE2D", "cSWIMWARPB", "cSWIMWARPC", "cSWIMWARPD", | ||
| 10062 | "cDIVEWARPB", "cDIVEWARPC", "cDIVEWARPD", "cSTAIRR", "cPITR", | ||
| 10063 | "cAWARPA", "cAWARPB", "cAWARPC", "cAWARPD", "cAWARPR", | ||
| 10064 | "cSWARPA", "cSWARPB", "cSWARPC", "cSWARPD", "cSWARPR", "cSTRIGNOFLAG", "cSTRIGFLAG", | ||
| 10065 | "cSTEP", "cSTEPSAME", "cSTEPALL", "cSTEPCOPY", "cNOENEMY", "cBLOCKARROW1", "cBLOCKARROW2", | ||
| 10066 | "cBLOCKARROW3", "cBLOCKBRANG1", "cBLOCKBRANG2", "cBLOCKBRANG3", "cBLOCKSBEAM", "cBLOCKALL", | ||
| 10067 | "cBLOCKFIREBALL", "cDAMAGE5", "cDAMAGE6", "cDAMAGE7", "cCHANGE", "cSPINTILE1", "cSPINTILE2", | ||
| 10068 | "cSCREENFREEZE", "cSCREENFREEZEFF", "cNOGROUNDENEMY", "cSLASHNEXT", "cSLASHNEXTITEM", "cBUSHNEXT" | ||
| 10069 | "cSLASHTOUCHY", "cSLASHITEMTOUCHY", "cBUSHTOUCHY", "cFLOWERSTOUCHY", "cTALLGRASSTOUCHY", | ||
| 10070 | "cSLASHNEXTTOUCHY", "cSLASHNEXTITEMTOUCHY", "cBUSHNEXTTOUCHY", "cEYEBALL_4", "cTALLGRASSNEXT", | ||
| 10071 | "cSCRIPT1", "cSCRIPT2", "cSCRIPT3", "cSCRIPT4", "cSCRIPT5", | ||
| 10072 | "cSCRIPT6", "cSCRIPT7", "cSCRIPT8", "cSCRIPT9", "cSCRIPT10", | ||
| 10073 | "cSCRIPT11", "cSCRIPT12", "cSCRIPT13", "cSCRIPT14", "cSCRIPT15", | ||
| 10074 | "cSCRIPT16", "cSCRIPT17", "cSCRIPT18", "cSCRIPT19", "cSCRIPT20" | ||
| 10075 | |||
| 10076 | }; | ||
| 10077 | |||
| 10078 | 764 | int32_t init_combo_classes() | |
| 10079 | { | ||
| 10080 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 764 times.
|
764 | zinfo* zi = (load_tmp_zi ? load_tmp_zi : &ZI); |
| 10081 |
2/2✓ Branch 0 taken 139812 times.
✓ Branch 1 taken 764 times.
|
140576 | for(int32_t i=0; i<cMAX; i++) |
| 10082 | { | ||
| 10083 | 139812 | combo_class_buf[i] = default_combo_classes[i]; | |
| 10084 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 139812 times.
|
139812 | if ( char const* nm = zi->getComboTypeName(i) ) |
| 10085 | { | ||
| 10086 | 139812 | size_t len = strlen(nm); | |
| 10087 |
2/2✓ Branch 0 taken 8947968 times.
✓ Branch 1 taken 139812 times.
|
9087780 | for ( size_t q = 0; q < 64; q++ ) |
| 10088 | { | ||
| 10089 |
2/2✓ Branch 0 taken 2048284 times.
✓ Branch 1 taken 6899684 times.
|
8947968 | combo_class_buf[i].name[q] = (q<len ? nm[q] : 0); |
| 10090 | 8947968 | } | |
| 10091 | 139812 | } | |
| 10092 | 139812 | } | |
| 10093 | |||
| 10094 | 764 | return 0; | |
| 10095 | } | ||
| 10096 | |||
| 10097 | 305 | int32_t readherosprites2(PACKFILE *f, int32_t v_herosprites) | |
| 10098 | { | ||
| 10099 |
2/2✓ Branch 0 taken 46 times.
✓ Branch 1 taken 259 times.
|
305 | bool should_skip = legacy_skip_flags && get_bit(legacy_skip_flags, skip_herosprites); |
| 10100 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 305 times.
|
305 | if (should_skip) return 0; |
| 10101 | |||
| 10102 |
1/2✓ Branch 0 taken 305 times.
✗ Branch 1 not taken.
|
305 | assert(v_herosprites < 6); |
| 10103 | |||
| 10104 | 305 | zinit.hero_swim_speed=67; //default | |
| 10105 | 305 | setupherotiles(zinit.heroAnimationStyle); | |
| 10106 | 305 | setupherodefenses(); | |
| 10107 | 305 | setupherooffsets(); | |
| 10108 | |||
| 10109 |
2/2✓ Branch 0 taken 105 times.
✓ Branch 1 taken 200 times.
|
305 | if(v_herosprites>=0) |
| 10110 | { | ||
| 10111 | word tile, tile2; | ||
| 10112 | byte flip, extend, dummy_byte; | ||
| 10113 | |||
| 10114 |
2/2✓ Branch 0 taken 800 times.
✓ Branch 1 taken 200 times.
|
1000 | for(int32_t i=0; i<4; i++) |
| 10115 | { | ||
| 10116 |
1/2✓ Branch 0 taken 800 times.
✗ Branch 1 not taken.
|
800 | if(!p_igetw(&tile,f)) |
| 10117 | { | ||
| 10118 | ✗ | return qe_invalid; | |
| 10119 | } | ||
| 10120 | |||
| 10121 |
1/2✓ Branch 0 taken 800 times.
✗ Branch 1 not taken.
|
800 | if(!p_getc(&flip,f)) |
| 10122 | { | ||
| 10123 | ✗ | return qe_invalid; | |
| 10124 | } | ||
| 10125 | |||
| 10126 |
1/2✓ Branch 0 taken 800 times.
✗ Branch 1 not taken.
|
800 | if(!p_getc(&extend,f)) |
| 10127 | { | ||
| 10128 | ✗ | return qe_invalid; | |
| 10129 | } | ||
| 10130 | |||
| 10131 | 800 | walkspr[i][spr_tile]=(int32_t)tile; | |
| 10132 | 800 | walkspr[i][spr_flip]=(int32_t)flip; | |
| 10133 | 800 | walkspr[i][spr_extend]=(int32_t)extend; | |
| 10134 | 800 | } | |
| 10135 | |||
| 10136 |
2/2✓ Branch 0 taken 800 times.
✓ Branch 1 taken 200 times.
|
1000 | for(int32_t i=0; i<4; i++) |
| 10137 | { | ||
| 10138 |
1/2✓ Branch 0 taken 800 times.
✗ Branch 1 not taken.
|
800 | if(!p_igetw(&tile,f)) |
| 10139 | { | ||
| 10140 | ✗ | return qe_invalid; | |
| 10141 | } | ||
| 10142 | |||
| 10143 |
1/2✓ Branch 0 taken 800 times.
✗ Branch 1 not taken.
|
800 | if(!p_getc(&flip,f)) |
| 10144 | { | ||
| 10145 | ✗ | return qe_invalid; | |
| 10146 | } | ||
| 10147 | |||
| 10148 |
1/2✓ Branch 0 taken 800 times.
✗ Branch 1 not taken.
|
800 | if(!p_getc(&extend,f)) |
| 10149 | { | ||
| 10150 | ✗ | return qe_invalid; | |
| 10151 | } | ||
| 10152 | |||
| 10153 | 800 | stabspr[i][spr_tile]=(int32_t)tile; | |
| 10154 | 800 | stabspr[i][spr_flip]=(int32_t)flip; | |
| 10155 | 800 | stabspr[i][spr_extend]=(int32_t)extend; | |
| 10156 | 800 | } | |
| 10157 | |||
| 10158 |
2/2✓ Branch 0 taken 800 times.
✓ Branch 1 taken 200 times.
|
1000 | for(int32_t i=0; i<4; i++) |
| 10159 | { | ||
| 10160 |
1/2✓ Branch 0 taken 800 times.
✗ Branch 1 not taken.
|
800 | if(!p_igetw(&tile,f)) |
| 10161 | { | ||
| 10162 | ✗ | return qe_invalid; | |
| 10163 | } | ||
| 10164 | |||
| 10165 |
1/2✓ Branch 0 taken 800 times.
✗ Branch 1 not taken.
|
800 | if(!p_getc(&flip,f)) |
| 10166 | { | ||
| 10167 | ✗ | return qe_invalid; | |
| 10168 | } | ||
| 10169 | |||
| 10170 |
1/2✓ Branch 0 taken 800 times.
✗ Branch 1 not taken.
|
800 | if(!p_getc(&extend,f)) |
| 10171 | { | ||
| 10172 | ✗ | return qe_invalid; | |
| 10173 | } | ||
| 10174 | |||
| 10175 | 800 | slashspr[i][spr_tile]=(int32_t)tile; | |
| 10176 | 800 | slashspr[i][spr_flip]=(int32_t)flip; | |
| 10177 | 800 | slashspr[i][spr_extend]=(int32_t)extend; | |
| 10178 | 800 | } | |
| 10179 | |||
| 10180 |
2/2✓ Branch 0 taken 800 times.
✓ Branch 1 taken 200 times.
|
1000 | for(int32_t i=0; i<4; i++) |
| 10181 | { | ||
| 10182 |
1/2✓ Branch 0 taken 800 times.
✗ Branch 1 not taken.
|
800 | if(!p_igetw(&tile,f)) |
| 10183 | { | ||
| 10184 | ✗ | return qe_invalid; | |
| 10185 | } | ||
| 10186 | |||
| 10187 |
1/2✓ Branch 0 taken 800 times.
✗ Branch 1 not taken.
|
800 | if(!p_getc(&flip,f)) |
| 10188 | { | ||
| 10189 | ✗ | return qe_invalid; | |
| 10190 | } | ||
| 10191 | |||
| 10192 |
1/2✓ Branch 0 taken 800 times.
✗ Branch 1 not taken.
|
800 | if(!p_getc(&extend,f)) |
| 10193 | { | ||
| 10194 | ✗ | return qe_invalid; | |
| 10195 | } | ||
| 10196 | |||
| 10197 | 800 | floatspr[i][spr_tile]=(int32_t)tile; | |
| 10198 | 800 | floatspr[i][spr_flip]=(int32_t)flip; | |
| 10199 | 800 | floatspr[i][spr_extend]=(int32_t)extend; | |
| 10200 | 800 | } | |
| 10201 | |||
| 10202 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 200 times.
|
200 | if(v_herosprites>1) |
| 10203 | { | ||
| 10204 |
2/2✓ Branch 0 taken 800 times.
✓ Branch 1 taken 200 times.
|
1000 | for(int32_t i=0; i<4; i++) |
| 10205 | { | ||
| 10206 |
1/2✓ Branch 0 taken 800 times.
✗ Branch 1 not taken.
|
800 | if(!p_igetw(&tile,f)) |
| 10207 | { | ||
| 10208 | ✗ | return qe_invalid; | |
| 10209 | } | ||
| 10210 | |||
| 10211 |
1/2✓ Branch 0 taken 800 times.
✗ Branch 1 not taken.
|
800 | if(!p_getc(&flip,f)) |
| 10212 | { | ||
| 10213 | ✗ | return qe_invalid; | |
| 10214 | } | ||
| 10215 | |||
| 10216 |
1/2✓ Branch 0 taken 800 times.
✗ Branch 1 not taken.
|
800 | if(!p_getc(&extend,f)) |
| 10217 | { | ||
| 10218 | ✗ | return qe_invalid; | |
| 10219 | } | ||
| 10220 | |||
| 10221 | 800 | swimspr[i][spr_tile]=(int32_t)tile; | |
| 10222 | 800 | swimspr[i][spr_flip]=(int32_t)flip; | |
| 10223 | 800 | swimspr[i][spr_extend]=(int32_t)extend; | |
| 10224 | 800 | } | |
| 10225 | 200 | } | |
| 10226 | |||
| 10227 |
2/2✓ Branch 0 taken 800 times.
✓ Branch 1 taken 200 times.
|
1000 | for(int32_t i=0; i<4; i++) |
| 10228 | { | ||
| 10229 |
1/2✓ Branch 0 taken 800 times.
✗ Branch 1 not taken.
|
800 | if(!p_igetw(&tile,f)) |
| 10230 | { | ||
| 10231 | ✗ | return qe_invalid; | |
| 10232 | } | ||
| 10233 | |||
| 10234 |
1/2✓ Branch 0 taken 800 times.
✗ Branch 1 not taken.
|
800 | if(!p_getc(&flip,f)) |
| 10235 | { | ||
| 10236 | ✗ | return qe_invalid; | |
| 10237 | } | ||
| 10238 | |||
| 10239 |
1/2✓ Branch 0 taken 800 times.
✗ Branch 1 not taken.
|
800 | if(!p_getc(&extend,f)) |
| 10240 | { | ||
| 10241 | ✗ | return qe_invalid; | |
| 10242 | } | ||
| 10243 | |||
| 10244 | 800 | divespr[i][spr_tile]=(int32_t)tile; | |
| 10245 | 800 | divespr[i][spr_flip]=(int32_t)flip; | |
| 10246 | 800 | divespr[i][spr_extend]=(int32_t)extend; | |
| 10247 | 800 | } | |
| 10248 | |||
| 10249 |
2/2✓ Branch 0 taken 800 times.
✓ Branch 1 taken 200 times.
|
1000 | for(int32_t i=0; i<4; i++) |
| 10250 | { | ||
| 10251 |
1/2✓ Branch 0 taken 800 times.
✗ Branch 1 not taken.
|
800 | if(!p_igetw(&tile,f)) |
| 10252 | { | ||
| 10253 | ✗ | return qe_invalid; | |
| 10254 | } | ||
| 10255 | |||
| 10256 |
1/2✓ Branch 0 taken 800 times.
✗ Branch 1 not taken.
|
800 | if(!p_getc(&flip,f)) |
| 10257 | { | ||
| 10258 | ✗ | return qe_invalid; | |
| 10259 | } | ||
| 10260 | |||
| 10261 |
1/2✓ Branch 0 taken 800 times.
✗ Branch 1 not taken.
|
800 | if(!p_getc(&extend,f)) |
| 10262 | { | ||
| 10263 | ✗ | return qe_invalid; | |
| 10264 | } | ||
| 10265 | |||
| 10266 | 800 | poundspr[i][spr_tile]=(int32_t)tile; | |
| 10267 | 800 | poundspr[i][spr_flip]=(int32_t)flip; | |
| 10268 | 800 | poundspr[i][spr_extend]=(int32_t)extend; | |
| 10269 | 800 | } | |
| 10270 | |||
| 10271 |
1/2✓ Branch 0 taken 200 times.
✗ Branch 1 not taken.
|
200 | if(!p_igetw(&tile,f)) |
| 10272 | { | ||
| 10273 | ✗ | return qe_invalid; | |
| 10274 | } | ||
| 10275 | |||
| 10276 | 200 | flip=0; | |
| 10277 | |||
| 10278 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 200 times.
|
200 | if(v_herosprites>0) |
| 10279 | { | ||
| 10280 |
1/2✓ Branch 0 taken 200 times.
✗ Branch 1 not taken.
|
200 | if(!p_getc(&flip,f)) |
| 10281 | { | ||
| 10282 | ✗ | return qe_invalid; | |
| 10283 | } | ||
| 10284 | 200 | } | |
| 10285 | |||
| 10286 |
1/2✓ Branch 0 taken 200 times.
✗ Branch 1 not taken.
|
200 | if(!p_getc(&extend,f)) |
| 10287 | { | ||
| 10288 | ✗ | return qe_invalid; | |
| 10289 | } | ||
| 10290 | |||
| 10291 | 200 | castingspr[spr_tile]=(int32_t)tile; | |
| 10292 | 200 | castingspr[spr_flip]=(int32_t)flip; | |
| 10293 | 200 | castingspr[spr_extend]=(int32_t)extend; | |
| 10294 | |||
| 10295 |
1/2✓ Branch 0 taken 200 times.
✗ Branch 1 not taken.
|
200 | if(v_herosprites>0) |
| 10296 | { | ||
| 10297 | 200 | int32_t num_holdsprs = (v_herosprites > 6 ? 3 : 2); | |
| 10298 |
2/2✓ Branch 0 taken 400 times.
✓ Branch 1 taken 200 times.
|
600 | for(int32_t i=0; i<2; i++) |
| 10299 | { | ||
| 10300 |
2/2✓ Branch 0 taken 800 times.
✓ Branch 1 taken 400 times.
|
1200 | for(int32_t j=0; j<num_holdsprs; j++) |
| 10301 | { | ||
| 10302 |
1/2✓ Branch 0 taken 800 times.
✗ Branch 1 not taken.
|
800 | if(!p_igetw(&tile,f)) |
| 10303 | { | ||
| 10304 | ✗ | return qe_invalid; | |
| 10305 | } | ||
| 10306 | |||
| 10307 |
1/2✓ Branch 0 taken 800 times.
✗ Branch 1 not taken.
|
800 | if(!p_getc(&flip,f)) |
| 10308 | { | ||
| 10309 | ✗ | return qe_invalid; | |
| 10310 | } | ||
| 10311 | |||
| 10312 |
1/2✓ Branch 0 taken 800 times.
✗ Branch 1 not taken.
|
800 | if(!p_getc(&extend,f)) |
| 10313 | { | ||
| 10314 | ✗ | return qe_invalid; | |
| 10315 | } | ||
| 10316 | |||
| 10317 | 800 | holdspr[i][j][spr_tile]=(int32_t)tile; | |
| 10318 | 800 | holdspr[i][j][spr_flip]=(int32_t)flip; | |
| 10319 | 800 | holdspr[i][j][spr_extend]=(int32_t)extend; | |
| 10320 | 800 | } | |
| 10321 | 400 | } | |
| 10322 | 200 | } | |
| 10323 | else | ||
| 10324 | { | ||
| 10325 | ✗ | for(int32_t i=0; i<2; i++) | |
| 10326 | { | ||
| 10327 | ✗ | if(!p_igetw(&tile,f)) | |
| 10328 | { | ||
| 10329 | ✗ | return qe_invalid; | |
| 10330 | } | ||
| 10331 | |||
| 10332 | ✗ | if(!p_igetw(&tile2,f)) | |
| 10333 | { | ||
| 10334 | ✗ | return qe_invalid; | |
| 10335 | } | ||
| 10336 | |||
| 10337 | ✗ | if(!p_getc(&extend,f)) | |
| 10338 | { | ||
| 10339 | ✗ | return qe_invalid; | |
| 10340 | } | ||
| 10341 | |||
| 10342 | ✗ | holdspr[i][spr_hold1][spr_tile]=(int32_t)tile; | |
| 10343 | ✗ | holdspr[i][spr_hold1][spr_flip]=(int32_t)flip; | |
| 10344 | ✗ | holdspr[i][spr_hold1][spr_extend]=(int32_t)extend; | |
| 10345 | ✗ | holdspr[i][spr_hold2][spr_tile]=(int32_t)tile2; | |
| 10346 | ✗ | holdspr[i][spr_hold2][spr_flip]=(int32_t)flip; | |
| 10347 | ✗ | holdspr[i][spr_hold2][spr_extend]=(int32_t)extend; | |
| 10348 | ✗ | } | |
| 10349 | } | ||
| 10350 | |||
| 10351 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 200 times.
|
200 | if(v_herosprites>2) |
| 10352 | { | ||
| 10353 |
2/2✓ Branch 0 taken 800 times.
✓ Branch 1 taken 200 times.
|
1000 | for(int32_t i=0; i<4; i++) |
| 10354 | { | ||
| 10355 |
1/2✓ Branch 0 taken 800 times.
✗ Branch 1 not taken.
|
800 | if(!p_igetw(&tile,f)) |
| 10356 | { | ||
| 10357 | ✗ | return qe_invalid; | |
| 10358 | } | ||
| 10359 | |||
| 10360 |
1/2✓ Branch 0 taken 800 times.
✗ Branch 1 not taken.
|
800 | if(!p_getc(&flip,f)) |
| 10361 | { | ||
| 10362 | ✗ | return qe_invalid; | |
| 10363 | } | ||
| 10364 | |||
| 10365 |
1/2✓ Branch 0 taken 800 times.
✗ Branch 1 not taken.
|
800 | if(!p_getc(&extend,f)) |
| 10366 | { | ||
| 10367 | ✗ | return qe_invalid; | |
| 10368 | } | ||
| 10369 | |||
| 10370 | 800 | jumpspr[i][spr_tile]=(int32_t)tile; | |
| 10371 | 800 | jumpspr[i][spr_flip]=(int32_t)flip; | |
| 10372 | 800 | jumpspr[i][spr_extend]=(int32_t)extend; | |
| 10373 | 800 | } | |
| 10374 | 200 | } | |
| 10375 | |||
| 10376 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 200 times.
|
200 | if(v_herosprites>3) |
| 10377 | { | ||
| 10378 |
2/2✓ Branch 0 taken 800 times.
✓ Branch 1 taken 200 times.
|
1000 | for(int32_t i=0; i<4; i++) |
| 10379 | { | ||
| 10380 |
1/2✓ Branch 0 taken 800 times.
✗ Branch 1 not taken.
|
800 | if(!p_igetw(&tile,f)) |
| 10381 | { | ||
| 10382 | ✗ | return qe_invalid; | |
| 10383 | } | ||
| 10384 | |||
| 10385 |
1/2✓ Branch 0 taken 800 times.
✗ Branch 1 not taken.
|
800 | if(!p_getc(&flip,f)) |
| 10386 | { | ||
| 10387 | ✗ | return qe_invalid; | |
| 10388 | } | ||
| 10389 | |||
| 10390 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 800 times.
|
800 | if(!p_getc(&extend,f)) |
| 10391 | { | ||
| 10392 | ✗ | return qe_invalid; | |
| 10393 | } | ||
| 10394 | |||
| 10395 | 800 | chargespr[i][spr_tile]=(int32_t)tile; | |
| 10396 | 800 | chargespr[i][spr_flip]=(int32_t)flip; | |
| 10397 | 800 | chargespr[i][spr_extend]=(int32_t)extend; | |
| 10398 | 800 | } | |
| 10399 | 200 | } | |
| 10400 | |||
| 10401 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 200 times.
|
200 | if(v_herosprites>4) |
| 10402 | { | ||
| 10403 |
1/2✓ Branch 0 taken 200 times.
✗ Branch 1 not taken.
|
200 | if(!p_getc(&dummy_byte,f)) |
| 10404 | { | ||
| 10405 | ✗ | return qe_invalid; | |
| 10406 | } | ||
| 10407 | |||
| 10408 | 200 | zinit.hero_swim_speed=(byte)dummy_byte; | |
| 10409 | 200 | } | |
| 10410 | |||
| 10411 | 200 | memset(frozenspr, 0, sizeof(frozenspr)); | |
| 10412 | 200 | memset(frozen_waterspr, 0, sizeof(frozen_waterspr)); | |
| 10413 | 200 | memset(onfirespr, 0, sizeof(onfirespr)); | |
| 10414 | 200 | memset(onfire_waterspr, 0, sizeof(onfire_waterspr)); | |
| 10415 | 200 | memset(diggingspr, 0, sizeof(diggingspr)); | |
| 10416 | 200 | memset(usingrodspr, 0, sizeof(usingrodspr)); | |
| 10417 | 200 | memset(usingcanespr, 0, sizeof(usingcanespr)); | |
| 10418 | 200 | memset(pushingspr, 0, sizeof(pushingspr)); | |
| 10419 | 200 | memset(liftingspr, 0, sizeof(liftingspr)); | |
| 10420 | 200 | memset(liftingwalkspr, 0, sizeof(liftingwalkspr)); | |
| 10421 | 200 | memset(stunnedspr, 0, sizeof(stunnedspr)); | |
| 10422 | 200 | memset(stunned_waterspr, 0, sizeof(stunned_waterspr)); | |
| 10423 | 200 | memset(fallingspr, 0, sizeof(fallingspr)); | |
| 10424 | 200 | memset(shockedspr, 0, sizeof(shockedspr)); | |
| 10425 | 200 | memset(shocked_waterspr, 0, sizeof(shocked_waterspr)); | |
| 10426 | 200 | memset(pullswordspr, 0, sizeof(pullswordspr)); | |
| 10427 | 200 | memset(readingspr, 0, sizeof(readingspr)); | |
| 10428 | 200 | memset(slash180spr, 0, sizeof(slash180spr)); | |
| 10429 | 200 | memset(slashZ4spr, 0, sizeof(slashZ4spr)); | |
| 10430 | 200 | memset(dashspr, 0, sizeof(dashspr)); | |
| 10431 | 200 | memset(bonkspr, 0, sizeof(bonkspr)); | |
| 10432 | 200 | memset(medallionsprs, 0, sizeof(medallionsprs)); | |
| 10433 | 200 | memset(holdspr[0][2], 0, sizeof(holdspr[0][2])); //Sword hold (Land) | |
| 10434 | 200 | memset(holdspr[1][2], 0, sizeof(holdspr[1][2])); //Sword hold (Water) | |
| 10435 |
2/2✓ Branch 0 taken 800 times.
✓ Branch 1 taken 200 times.
|
1000 | for(int32_t q = 0; q < 4; ++q) |
| 10436 | { | ||
| 10437 |
2/2✓ Branch 0 taken 2400 times.
✓ Branch 1 taken 800 times.
|
3200 | for(int32_t p = 0; p < 3; ++p) |
| 10438 | { | ||
| 10439 | 2400 | drowningspr[q][p] = divespr[q][p]; | |
| 10440 | 2400 | drowning_lavaspr[q][p] = divespr[q][p]; | |
| 10441 | 2400 | } | |
| 10442 | 800 | } | |
| 10443 | 200 | memset(sideswimspr, 0, sizeof(sideswimspr)); | |
| 10444 | 200 | memset(sideswimslashspr, 0, sizeof(sideswimslashspr)); | |
| 10445 | 200 | memset(sideswimstabspr, 0, sizeof(sideswimstabspr)); | |
| 10446 | 200 | memset(sideswimpoundspr, 0, sizeof(sideswimpoundspr)); | |
| 10447 | 200 | memset(sideswimchargespr, 0, sizeof(sideswimchargespr)); | |
| 10448 | 200 | memset(sideswimholdspr, 0, sizeof(sideswimholdspr)); | |
| 10449 | 200 | memset(sidedrowningspr, 0, sizeof(sidedrowningspr)); | |
| 10450 | 200 | } | |
| 10451 | |||
| 10452 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 305 times.
|
305 | if(FFCore.quest_format[vInitData] < 34) |
| 10453 | { | ||
| 10454 | 305 | bool fastswim = zinit.hero_swim_speed > 60; | |
| 10455 | // '2/3' or '1/2' | ||
| 10456 | 305 | zinit.hero_swim_mult = fastswim ? 2 : 1; | |
| 10457 | 305 | zinit.hero_swim_div = fastswim ? 3 : 2; | |
| 10458 | 305 | } | |
| 10459 | 305 | return 0; | |
| 10460 | 305 | } | |
| 10461 | |||
| 10462 | 33320 | void setSprite(int32_t* arr, int32_t tile, int32_t flip, int32_t ext) | |
| 10463 | { | ||
| 10464 | 33320 | arr[spr_tile] = tile; | |
| 10465 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 33320 times.
|
33320 | arr[spr_flip] = (flip > 3 ? 0 : flip); |
| 10466 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 33320 times.
|
33320 | arr[spr_extend] = (ext > 2 ? 0 : ext); |
| 10467 | 33320 | } | |
| 10468 | //Used to read the player sprites as int32_t, not word. | ||
| 10469 | 196 | int32_t readherosprites3(PACKFILE *f, int32_t v_herosprites) | |
| 10470 | { | ||
| 10471 | 196 | zinit.hero_swim_speed=67; //default | |
| 10472 | 196 | setupherotiles(zinit.heroAnimationStyle); | |
| 10473 | 196 | setupherodefenses(); | |
| 10474 | 196 | setupherooffsets(); | |
| 10475 | |||
| 10476 | int32_t tile, tile2; | ||
| 10477 | byte flip, extend, dummy_byte; | ||
| 10478 | |||
| 10479 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 196 times.
|
196 | if(v_herosprites>=0) |
| 10480 | { | ||
| 10481 | |||
| 10482 |
2/2✓ Branch 0 taken 784 times.
✓ Branch 1 taken 196 times.
|
980 | for(int32_t i=0; i<4; i++) |
| 10483 | { | ||
| 10484 |
1/2✓ Branch 0 taken 784 times.
✗ Branch 1 not taken.
|
784 | if(!p_igetl(&tile,f)) |
| 10485 | { | ||
| 10486 | ✗ | return qe_invalid; | |
| 10487 | } | ||
| 10488 | |||
| 10489 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 784 times.
|
784 | if(!p_getc(&flip,f)) |
| 10490 | { | ||
| 10491 | ✗ | return qe_invalid; | |
| 10492 | } | ||
| 10493 | |||
| 10494 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 784 times.
|
784 | if(!p_getc(&extend,f)) |
| 10495 | { | ||
| 10496 | ✗ | return qe_invalid; | |
| 10497 | } | ||
| 10498 | |||
| 10499 | 784 | setSprite(walkspr[i], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 10500 | 784 | } | |
| 10501 | |||
| 10502 |
2/2✓ Branch 0 taken 784 times.
✓ Branch 1 taken 196 times.
|
980 | for(int32_t i=0; i<4; i++) |
| 10503 | { | ||
| 10504 |
1/2✓ Branch 0 taken 784 times.
✗ Branch 1 not taken.
|
784 | if(!p_igetl(&tile,f)) |
| 10505 | { | ||
| 10506 | ✗ | return qe_invalid; | |
| 10507 | } | ||
| 10508 | |||
| 10509 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 784 times.
|
784 | if(!p_getc(&flip,f)) |
| 10510 | { | ||
| 10511 | ✗ | return qe_invalid; | |
| 10512 | } | ||
| 10513 | |||
| 10514 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 784 times.
|
784 | if(!p_getc(&extend,f)) |
| 10515 | { | ||
| 10516 | ✗ | return qe_invalid; | |
| 10517 | } | ||
| 10518 | |||
| 10519 | 784 | setSprite(stabspr[i], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 10520 | 784 | } | |
| 10521 | |||
| 10522 |
2/2✓ Branch 0 taken 784 times.
✓ Branch 1 taken 196 times.
|
980 | for(int32_t i=0; i<4; i++) |
| 10523 | { | ||
| 10524 |
1/2✓ Branch 0 taken 784 times.
✗ Branch 1 not taken.
|
784 | if(!p_igetl(&tile,f)) |
| 10525 | { | ||
| 10526 | ✗ | return qe_invalid; | |
| 10527 | } | ||
| 10528 | |||
| 10529 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 784 times.
|
784 | if(!p_getc(&flip,f)) |
| 10530 | { | ||
| 10531 | ✗ | return qe_invalid; | |
| 10532 | } | ||
| 10533 | |||
| 10534 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 784 times.
|
784 | if(!p_getc(&extend,f)) |
| 10535 | { | ||
| 10536 | ✗ | return qe_invalid; | |
| 10537 | } | ||
| 10538 | |||
| 10539 | 784 | setSprite(slashspr[i], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 10540 | 784 | } | |
| 10541 | |||
| 10542 |
2/2✓ Branch 0 taken 784 times.
✓ Branch 1 taken 196 times.
|
980 | for(int32_t i=0; i<4; i++) |
| 10543 | { | ||
| 10544 |
1/2✓ Branch 0 taken 784 times.
✗ Branch 1 not taken.
|
784 | if(!p_igetl(&tile,f)) |
| 10545 | { | ||
| 10546 | ✗ | return qe_invalid; | |
| 10547 | } | ||
| 10548 | |||
| 10549 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 784 times.
|
784 | if(!p_getc(&flip,f)) |
| 10550 | { | ||
| 10551 | ✗ | return qe_invalid; | |
| 10552 | } | ||
| 10553 | |||
| 10554 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 784 times.
|
784 | if(!p_getc(&extend,f)) |
| 10555 | { | ||
| 10556 | ✗ | return qe_invalid; | |
| 10557 | } | ||
| 10558 | |||
| 10559 | 784 | setSprite(floatspr[i], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 10560 | 784 | } | |
| 10561 | |||
| 10562 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 196 times.
|
196 | if(v_herosprites>1) |
| 10563 | { | ||
| 10564 |
2/2✓ Branch 0 taken 784 times.
✓ Branch 1 taken 196 times.
|
980 | for(int32_t i=0; i<4; i++) |
| 10565 | { | ||
| 10566 |
1/2✓ Branch 0 taken 784 times.
✗ Branch 1 not taken.
|
784 | if(!p_igetl(&tile,f)) |
| 10567 | { | ||
| 10568 | ✗ | return qe_invalid; | |
| 10569 | } | ||
| 10570 | |||
| 10571 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 784 times.
|
784 | if(!p_getc(&flip,f)) |
| 10572 | { | ||
| 10573 | ✗ | return qe_invalid; | |
| 10574 | } | ||
| 10575 | |||
| 10576 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 784 times.
|
784 | if(!p_getc(&extend,f)) |
| 10577 | { | ||
| 10578 | ✗ | return qe_invalid; | |
| 10579 | } | ||
| 10580 | |||
| 10581 | 784 | setSprite(swimspr[i], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 10582 | 784 | } | |
| 10583 | 196 | } | |
| 10584 | |||
| 10585 |
2/2✓ Branch 0 taken 784 times.
✓ Branch 1 taken 196 times.
|
980 | for(int32_t i=0; i<4; i++) |
| 10586 | { | ||
| 10587 |
1/2✓ Branch 0 taken 784 times.
✗ Branch 1 not taken.
|
784 | if(!p_igetl(&tile,f)) |
| 10588 | { | ||
| 10589 | ✗ | return qe_invalid; | |
| 10590 | } | ||
| 10591 | |||
| 10592 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 784 times.
|
784 | if(!p_getc(&flip,f)) |
| 10593 | { | ||
| 10594 | ✗ | return qe_invalid; | |
| 10595 | } | ||
| 10596 | |||
| 10597 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 784 times.
|
784 | if(!p_getc(&extend,f)) |
| 10598 | { | ||
| 10599 | ✗ | return qe_invalid; | |
| 10600 | } | ||
| 10601 | |||
| 10602 | 784 | setSprite(divespr[i], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 10603 | 784 | } | |
| 10604 | |||
| 10605 |
2/2✓ Branch 0 taken 784 times.
✓ Branch 1 taken 196 times.
|
980 | for(int32_t i=0; i<4; i++) |
| 10606 | { | ||
| 10607 |
1/2✓ Branch 0 taken 784 times.
✗ Branch 1 not taken.
|
784 | if(!p_igetl(&tile,f)) |
| 10608 | { | ||
| 10609 | ✗ | return qe_invalid; | |
| 10610 | } | ||
| 10611 | |||
| 10612 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 784 times.
|
784 | if(!p_getc(&flip,f)) |
| 10613 | { | ||
| 10614 | ✗ | return qe_invalid; | |
| 10615 | } | ||
| 10616 | |||
| 10617 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 784 times.
|
784 | if(!p_getc(&extend,f)) |
| 10618 | { | ||
| 10619 | ✗ | return qe_invalid; | |
| 10620 | } | ||
| 10621 | |||
| 10622 | 784 | setSprite(poundspr[i], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 10623 | 784 | } | |
| 10624 | |||
| 10625 |
1/2✓ Branch 0 taken 196 times.
✗ Branch 1 not taken.
|
196 | if(!p_igetl(&tile,f)) |
| 10626 | { | ||
| 10627 | ✗ | return qe_invalid; | |
| 10628 | } | ||
| 10629 | |||
| 10630 | 196 | flip=0; | |
| 10631 | |||
| 10632 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 196 times.
|
196 | if(v_herosprites>0) |
| 10633 | { | ||
| 10634 |
1/2✓ Branch 0 taken 196 times.
✗ Branch 1 not taken.
|
196 | if(!p_getc(&flip,f)) |
| 10635 | { | ||
| 10636 | ✗ | return qe_invalid; | |
| 10637 | } | ||
| 10638 | 196 | } | |
| 10639 | |||
| 10640 |
1/2✓ Branch 0 taken 196 times.
✗ Branch 1 not taken.
|
196 | if(!p_getc(&extend,f)) |
| 10641 | { | ||
| 10642 | ✗ | return qe_invalid; | |
| 10643 | } | ||
| 10644 | |||
| 10645 | 196 | setSprite(castingspr, int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 10646 | |||
| 10647 |
1/2✓ Branch 0 taken 196 times.
✗ Branch 1 not taken.
|
196 | if(v_herosprites>0) |
| 10648 | { | ||
| 10649 | 196 | int32_t num_holdsprs = (v_herosprites > 6 ? 3 : 2); | |
| 10650 |
2/2✓ Branch 0 taken 392 times.
✓ Branch 1 taken 196 times.
|
588 | for(int32_t i=0; i<2; i++) |
| 10651 | { | ||
| 10652 |
2/2✓ Branch 0 taken 1176 times.
✓ Branch 1 taken 392 times.
|
1568 | for(int32_t j=0; j<num_holdsprs; j++) |
| 10653 | { | ||
| 10654 |
1/2✓ Branch 0 taken 1176 times.
✗ Branch 1 not taken.
|
1176 | if(!p_igetl(&tile,f)) |
| 10655 | { | ||
| 10656 | ✗ | return qe_invalid; | |
| 10657 | } | ||
| 10658 | |||
| 10659 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1176 times.
|
1176 | if(!p_getc(&flip,f)) |
| 10660 | { | ||
| 10661 | ✗ | return qe_invalid; | |
| 10662 | } | ||
| 10663 | |||
| 10664 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1176 times.
|
1176 | if(!p_getc(&extend,f)) |
| 10665 | { | ||
| 10666 | ✗ | return qe_invalid; | |
| 10667 | } | ||
| 10668 | |||
| 10669 | 1176 | setSprite(holdspr[i][j], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 10670 | 1176 | } | |
| 10671 | 392 | } | |
| 10672 | 196 | } | |
| 10673 | else | ||
| 10674 | { | ||
| 10675 | ✗ | for(int32_t i=0; i<2; i++) | |
| 10676 | { | ||
| 10677 | ✗ | if(!p_igetl(&tile,f)) | |
| 10678 | { | ||
| 10679 | ✗ | return qe_invalid; | |
| 10680 | } | ||
| 10681 | |||
| 10682 | ✗ | if(!p_igetl(&tile2,f)) | |
| 10683 | { | ||
| 10684 | ✗ | return qe_invalid; | |
| 10685 | } | ||
| 10686 | |||
| 10687 | ✗ | if(!p_getc(&extend,f)) | |
| 10688 | { | ||
| 10689 | ✗ | return qe_invalid; | |
| 10690 | } | ||
| 10691 | |||
| 10692 | ✗ | setSprite(holdspr[i][spr_hold1], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 10693 | ✗ | setSprite(holdspr[i][spr_hold2], int32_t(tile2), int32_t(flip), int32_t(extend)); | |
| 10694 | ✗ | } | |
| 10695 | } | ||
| 10696 | |||
| 10697 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 196 times.
|
196 | if(v_herosprites>2) |
| 10698 | { | ||
| 10699 |
2/2✓ Branch 0 taken 784 times.
✓ Branch 1 taken 196 times.
|
980 | for(int32_t i=0; i<4; i++) |
| 10700 | { | ||
| 10701 |
1/2✓ Branch 0 taken 784 times.
✗ Branch 1 not taken.
|
784 | if(!p_igetl(&tile,f)) |
| 10702 | { | ||
| 10703 | ✗ | return qe_invalid; | |
| 10704 | } | ||
| 10705 | |||
| 10706 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 784 times.
|
784 | if(!p_getc(&flip,f)) |
| 10707 | { | ||
| 10708 | ✗ | return qe_invalid; | |
| 10709 | } | ||
| 10710 | |||
| 10711 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 784 times.
|
784 | if(!p_getc(&extend,f)) |
| 10712 | { | ||
| 10713 | ✗ | return qe_invalid; | |
| 10714 | } | ||
| 10715 | |||
| 10716 | 784 | setSprite(jumpspr[i], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 10717 | 784 | } | |
| 10718 | 196 | } | |
| 10719 | |||
| 10720 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 196 times.
|
196 | if(v_herosprites>3) |
| 10721 | { | ||
| 10722 |
2/2✓ Branch 0 taken 784 times.
✓ Branch 1 taken 196 times.
|
980 | for(int32_t i=0; i<4; i++) |
| 10723 | { | ||
| 10724 |
1/2✓ Branch 0 taken 784 times.
✗ Branch 1 not taken.
|
784 | if(!p_igetl(&tile,f)) |
| 10725 | { | ||
| 10726 | ✗ | return qe_invalid; | |
| 10727 | } | ||
| 10728 | |||
| 10729 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 784 times.
|
784 | if(!p_getc(&flip,f)) |
| 10730 | { | ||
| 10731 | ✗ | return qe_invalid; | |
| 10732 | } | ||
| 10733 | |||
| 10734 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 784 times.
|
784 | if(!p_getc(&extend,f)) |
| 10735 | { | ||
| 10736 | ✗ | return qe_invalid; | |
| 10737 | } | ||
| 10738 | |||
| 10739 | 784 | setSprite(chargespr[i], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 10740 | 784 | } | |
| 10741 | 196 | } | |
| 10742 | |||
| 10743 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 196 times.
|
196 | if(v_herosprites>4) |
| 10744 | { | ||
| 10745 |
1/2✓ Branch 0 taken 196 times.
✗ Branch 1 not taken.
|
196 | if(!p_getc(&dummy_byte,f)) |
| 10746 | { | ||
| 10747 | ✗ | return qe_invalid; | |
| 10748 | } | ||
| 10749 | |||
| 10750 | 196 | zinit.hero_swim_speed=(byte)dummy_byte; | |
| 10751 | 196 | } | |
| 10752 | |||
| 10753 |
1/2✓ Branch 0 taken 196 times.
✗ Branch 1 not taken.
|
196 | if(v_herosprites>6) |
| 10754 | { | ||
| 10755 |
2/2✓ Branch 0 taken 784 times.
✓ Branch 1 taken 196 times.
|
980 | for(int32_t q = 0; q < 4; ++q) |
| 10756 | { | ||
| 10757 |
1/2✓ Branch 0 taken 784 times.
✗ Branch 1 not taken.
|
784 | if(!p_igetl(&tile,f)) |
| 10758 | ✗ | return qe_invalid; | |
| 10759 | |||
| 10760 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 784 times.
|
784 | if(!p_getc(&flip,f)) |
| 10761 | ✗ | return qe_invalid; | |
| 10762 | |||
| 10763 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 784 times.
|
784 | if(!p_getc(&extend,f)) |
| 10764 | ✗ | return qe_invalid; | |
| 10765 | |||
| 10766 | 784 | setSprite(frozenspr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 10767 | 784 | } | |
| 10768 |
2/2✓ Branch 0 taken 784 times.
✓ Branch 1 taken 196 times.
|
980 | for(int32_t q = 0; q < 4; ++q) |
| 10769 | { | ||
| 10770 |
1/2✓ Branch 0 taken 784 times.
✗ Branch 1 not taken.
|
784 | if(!p_igetl(&tile,f)) |
| 10771 | ✗ | return qe_invalid; | |
| 10772 | |||
| 10773 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 784 times.
|
784 | if(!p_getc(&flip,f)) |
| 10774 | ✗ | return qe_invalid; | |
| 10775 | |||
| 10776 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 784 times.
|
784 | if(!p_getc(&extend,f)) |
| 10777 | ✗ | return qe_invalid; | |
| 10778 | |||
| 10779 | 784 | setSprite(frozen_waterspr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 10780 | 784 | } | |
| 10781 | |||
| 10782 |
2/2✓ Branch 0 taken 784 times.
✓ Branch 1 taken 196 times.
|
980 | for(int32_t q = 0; q < 4; ++q) |
| 10783 | { | ||
| 10784 |
1/2✓ Branch 0 taken 784 times.
✗ Branch 1 not taken.
|
784 | if(!p_igetl(&tile,f)) |
| 10785 | ✗ | return qe_invalid; | |
| 10786 | |||
| 10787 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 784 times.
|
784 | if(!p_getc(&flip,f)) |
| 10788 | ✗ | return qe_invalid; | |
| 10789 | |||
| 10790 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 784 times.
|
784 | if(!p_getc(&extend,f)) |
| 10791 | ✗ | return qe_invalid; | |
| 10792 | |||
| 10793 | 784 | setSprite(onfirespr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 10794 | 784 | } | |
| 10795 |
2/2✓ Branch 0 taken 784 times.
✓ Branch 1 taken 196 times.
|
980 | for(int32_t q = 0; q < 4; ++q) |
| 10796 | { | ||
| 10797 |
1/2✓ Branch 0 taken 784 times.
✗ Branch 1 not taken.
|
784 | if(!p_igetl(&tile,f)) |
| 10798 | ✗ | return qe_invalid; | |
| 10799 | |||
| 10800 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 784 times.
|
784 | if(!p_getc(&flip,f)) |
| 10801 | ✗ | return qe_invalid; | |
| 10802 | |||
| 10803 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 784 times.
|
784 | if(!p_getc(&extend,f)) |
| 10804 | ✗ | return qe_invalid; | |
| 10805 | |||
| 10806 | 784 | setSprite(onfire_waterspr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 10807 | 784 | } | |
| 10808 | |||
| 10809 |
2/2✓ Branch 0 taken 784 times.
✓ Branch 1 taken 196 times.
|
980 | for(int32_t q = 0; q < 4; ++q) |
| 10810 | { | ||
| 10811 |
1/2✓ Branch 0 taken 784 times.
✗ Branch 1 not taken.
|
784 | if(!p_igetl(&tile,f)) |
| 10812 | ✗ | return qe_invalid; | |
| 10813 | |||
| 10814 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 784 times.
|
784 | if(!p_getc(&flip,f)) |
| 10815 | ✗ | return qe_invalid; | |
| 10816 | |||
| 10817 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 784 times.
|
784 | if(!p_getc(&extend,f)) |
| 10818 | ✗ | return qe_invalid; | |
| 10819 | |||
| 10820 | 784 | setSprite(diggingspr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 10821 | 784 | } | |
| 10822 | |||
| 10823 |
2/2✓ Branch 0 taken 784 times.
✓ Branch 1 taken 196 times.
|
980 | for(int32_t q = 0; q < 4; ++q) |
| 10824 | { | ||
| 10825 |
1/2✓ Branch 0 taken 784 times.
✗ Branch 1 not taken.
|
784 | if(!p_igetl(&tile,f)) |
| 10826 | ✗ | return qe_invalid; | |
| 10827 | |||
| 10828 |
1/2✓ Branch 0 taken 784 times.
✗ Branch 1 not taken.
|
784 | if(!p_getc(&flip,f)) |
| 10829 | ✗ | return qe_invalid; | |
| 10830 | |||
| 10831 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 784 times.
|
784 | if(!p_getc(&extend,f)) |
| 10832 | ✗ | return qe_invalid; | |
| 10833 | |||
| 10834 | 784 | setSprite(usingrodspr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 10835 | 784 | } | |
| 10836 | |||
| 10837 |
2/2✓ Branch 0 taken 784 times.
✓ Branch 1 taken 196 times.
|
980 | for(int32_t q = 0; q < 4; ++q) |
| 10838 | { | ||
| 10839 |
1/2✓ Branch 0 taken 784 times.
✗ Branch 1 not taken.
|
784 | if(!p_igetl(&tile,f)) |
| 10840 | ✗ | return qe_invalid; | |
| 10841 | |||
| 10842 |
1/2✓ Branch 0 taken 784 times.
✗ Branch 1 not taken.
|
784 | if(!p_getc(&flip,f)) |
| 10843 | ✗ | return qe_invalid; | |
| 10844 | |||
| 10845 |
1/2✓ Branch 0 taken 784 times.
✗ Branch 1 not taken.
|
784 | if(!p_getc(&extend,f)) |
| 10846 | ✗ | return qe_invalid; | |
| 10847 | |||
| 10848 | 784 | setSprite(usingcanespr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 10849 | 784 | } | |
| 10850 | |||
| 10851 |
2/2✓ Branch 0 taken 784 times.
✓ Branch 1 taken 196 times.
|
980 | for(int32_t q = 0; q < 4; ++q) |
| 10852 | { | ||
| 10853 |
1/2✓ Branch 0 taken 784 times.
✗ Branch 1 not taken.
|
784 | if(!p_igetl(&tile,f)) |
| 10854 | ✗ | return qe_invalid; | |
| 10855 | |||
| 10856 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 784 times.
|
784 | if(!p_getc(&flip,f)) |
| 10857 | ✗ | return qe_invalid; | |
| 10858 | |||
| 10859 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 784 times.
|
784 | if(!p_getc(&extend,f)) |
| 10860 | ✗ | return qe_invalid; | |
| 10861 | |||
| 10862 | 784 | setSprite(pushingspr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 10863 | 784 | } | |
| 10864 | |||
| 10865 |
2/2✓ Branch 0 taken 784 times.
✓ Branch 1 taken 196 times.
|
980 | for(int32_t q = 0; q < 4; ++q) |
| 10866 | { | ||
| 10867 |
1/2✓ Branch 0 taken 784 times.
✗ Branch 1 not taken.
|
784 | if(!p_igetl(&tile,f)) |
| 10868 | ✗ | return qe_invalid; | |
| 10869 | |||
| 10870 |
1/2✓ Branch 0 taken 784 times.
✗ Branch 1 not taken.
|
784 | if(!p_getc(&flip,f)) |
| 10871 | ✗ | return qe_invalid; | |
| 10872 | |||
| 10873 |
1/2✓ Branch 0 taken 784 times.
✗ Branch 1 not taken.
|
784 | if(!p_getc(&extend,f)) |
| 10874 | ✗ | return qe_invalid; | |
| 10875 | |||
| 10876 | 784 | byte frames = 0; | |
| 10877 |
2/2✓ Branch 0 taken 16 times.
✓ Branch 1 taken 768 times.
|
784 | if(v_herosprites > 15) |
| 10878 | { | ||
| 10879 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 768 times.
|
768 | if(!p_getc(&frames,f)) |
| 10880 | ✗ | return qe_invalid; | |
| 10881 | 768 | } | |
| 10882 | |||
| 10883 | 784 | setSprite(liftingspr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 10884 | 784 | liftingspr[q][spr_frames] = frames; | |
| 10885 | 784 | } | |
| 10886 | |||
| 10887 |
2/2✓ Branch 0 taken 784 times.
✓ Branch 1 taken 196 times.
|
980 | for(int32_t q = 0; q < 4; ++q) |
| 10888 | { | ||
| 10889 |
1/2✓ Branch 0 taken 784 times.
✗ Branch 1 not taken.
|
784 | if(!p_igetl(&tile,f)) |
| 10890 | ✗ | return qe_invalid; | |
| 10891 | |||
| 10892 |
1/2✓ Branch 0 taken 784 times.
✗ Branch 1 not taken.
|
784 | if(!p_getc(&flip,f)) |
| 10893 | ✗ | return qe_invalid; | |
| 10894 | |||
| 10895 |
1/2✓ Branch 0 taken 784 times.
✗ Branch 1 not taken.
|
784 | if(!p_getc(&extend,f)) |
| 10896 | ✗ | return qe_invalid; | |
| 10897 | |||
| 10898 | 784 | setSprite(liftingwalkspr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 10899 | 784 | } | |
| 10900 | |||
| 10901 |
2/2✓ Branch 0 taken 784 times.
✓ Branch 1 taken 196 times.
|
980 | for(int32_t q = 0; q < 4; ++q) |
| 10902 | { | ||
| 10903 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 784 times.
|
784 | if(!p_igetl(&tile,f)) |
| 10904 | ✗ | return qe_invalid; | |
| 10905 | |||
| 10906 |
1/2✓ Branch 0 taken 784 times.
✗ Branch 1 not taken.
|
784 | if(!p_getc(&flip,f)) |
| 10907 | ✗ | return qe_invalid; | |
| 10908 | |||
| 10909 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 784 times.
|
784 | if(!p_getc(&extend,f)) |
| 10910 | ✗ | return qe_invalid; | |
| 10911 | |||
| 10912 | 784 | setSprite(stunnedspr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 10913 | 784 | } | |
| 10914 |
2/2✓ Branch 0 taken 784 times.
✓ Branch 1 taken 196 times.
|
980 | for(int32_t q = 0; q < 4; ++q) |
| 10915 | { | ||
| 10916 |
1/2✓ Branch 0 taken 784 times.
✗ Branch 1 not taken.
|
784 | if(!p_igetl(&tile,f)) |
| 10917 | ✗ | return qe_invalid; | |
| 10918 | |||
| 10919 |
1/2✓ Branch 0 taken 784 times.
✗ Branch 1 not taken.
|
784 | if(!p_getc(&flip,f)) |
| 10920 | ✗ | return qe_invalid; | |
| 10921 | |||
| 10922 |
1/2✓ Branch 0 taken 784 times.
✗ Branch 1 not taken.
|
784 | if(!p_getc(&extend,f)) |
| 10923 | ✗ | return qe_invalid; | |
| 10924 | |||
| 10925 | 784 | setSprite(stunned_waterspr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 10926 | 784 | } | |
| 10927 | |||
| 10928 |
2/2✓ Branch 0 taken 784 times.
✓ Branch 1 taken 196 times.
|
980 | for(int32_t q = 0; q < 4; ++q) |
| 10929 | { | ||
| 10930 |
1/2✓ Branch 0 taken 784 times.
✗ Branch 1 not taken.
|
784 | if(!p_igetl(&tile,f)) |
| 10931 | ✗ | return qe_invalid; | |
| 10932 | |||
| 10933 |
1/2✓ Branch 0 taken 784 times.
✗ Branch 1 not taken.
|
784 | if(!p_getc(&flip,f)) |
| 10934 | ✗ | return qe_invalid; | |
| 10935 | |||
| 10936 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 784 times.
|
784 | if(!p_getc(&extend,f)) |
| 10937 | ✗ | return qe_invalid; | |
| 10938 | |||
| 10939 | 784 | setSprite(drowningspr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 10940 | 784 | } | |
| 10941 | |||
| 10942 |
2/2✓ Branch 0 taken 784 times.
✓ Branch 1 taken 196 times.
|
980 | for(int32_t q = 0; q < 4; ++q) |
| 10943 | { | ||
| 10944 |
1/2✓ Branch 0 taken 784 times.
✗ Branch 1 not taken.
|
784 | if(!p_igetl(&tile,f)) |
| 10945 | ✗ | return qe_invalid; | |
| 10946 | |||
| 10947 |
1/2✓ Branch 0 taken 784 times.
✗ Branch 1 not taken.
|
784 | if(!p_getc(&flip,f)) |
| 10948 | ✗ | return qe_invalid; | |
| 10949 | |||
| 10950 |
1/2✓ Branch 0 taken 784 times.
✗ Branch 1 not taken.
|
784 | if(!p_getc(&extend,f)) |
| 10951 | ✗ | return qe_invalid; | |
| 10952 | |||
| 10953 | 784 | setSprite(drowning_lavaspr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 10954 | 784 | } | |
| 10955 | |||
| 10956 |
2/2✓ Branch 0 taken 784 times.
✓ Branch 1 taken 196 times.
|
980 | for(int32_t q = 0; q < 4; ++q) |
| 10957 | { | ||
| 10958 |
1/2✓ Branch 0 taken 784 times.
✗ Branch 1 not taken.
|
784 | if(!p_igetl(&tile,f)) |
| 10959 | ✗ | return qe_invalid; | |
| 10960 | |||
| 10961 |
1/2✓ Branch 0 taken 784 times.
✗ Branch 1 not taken.
|
784 | if(!p_getc(&flip,f)) |
| 10962 | ✗ | return qe_invalid; | |
| 10963 | |||
| 10964 |
1/2✓ Branch 0 taken 784 times.
✗ Branch 1 not taken.
|
784 | if(!p_getc(&extend,f)) |
| 10965 | ✗ | return qe_invalid; | |
| 10966 | |||
| 10967 | 784 | setSprite(fallingspr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 10968 | 784 | } | |
| 10969 | |||
| 10970 |
2/2✓ Branch 0 taken 784 times.
✓ Branch 1 taken 196 times.
|
980 | for(int32_t q = 0; q < 4; ++q) |
| 10971 | { | ||
| 10972 |
1/2✓ Branch 0 taken 784 times.
✗ Branch 1 not taken.
|
784 | if(!p_igetl(&tile,f)) |
| 10973 | ✗ | return qe_invalid; | |
| 10974 | |||
| 10975 |
1/2✓ Branch 0 taken 784 times.
✗ Branch 1 not taken.
|
784 | if(!p_getc(&flip,f)) |
| 10976 | ✗ | return qe_invalid; | |
| 10977 | |||
| 10978 |
1/2✓ Branch 0 taken 784 times.
✗ Branch 1 not taken.
|
784 | if(!p_getc(&extend,f)) |
| 10979 | ✗ | return qe_invalid; | |
| 10980 | |||
| 10981 | 784 | setSprite(shockedspr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 10982 | 784 | } | |
| 10983 |
2/2✓ Branch 0 taken 784 times.
✓ Branch 1 taken 196 times.
|
980 | for(int32_t q = 0; q < 4; ++q) |
| 10984 | { | ||
| 10985 |
1/2✓ Branch 0 taken 784 times.
✗ Branch 1 not taken.
|
784 | if(!p_igetl(&tile,f)) |
| 10986 | ✗ | return qe_invalid; | |
| 10987 | |||
| 10988 |
1/2✓ Branch 0 taken 784 times.
✗ Branch 1 not taken.
|
784 | if(!p_getc(&flip,f)) |
| 10989 | ✗ | return qe_invalid; | |
| 10990 | |||
| 10991 |
1/2✓ Branch 0 taken 784 times.
✗ Branch 1 not taken.
|
784 | if(!p_getc(&extend,f)) |
| 10992 | ✗ | return qe_invalid; | |
| 10993 | |||
| 10994 | 784 | setSprite(shocked_waterspr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 10995 | 784 | } | |
| 10996 | |||
| 10997 |
2/2✓ Branch 0 taken 784 times.
✓ Branch 1 taken 196 times.
|
980 | for(int32_t q = 0; q < 4; ++q) |
| 10998 | { | ||
| 10999 |
1/2✓ Branch 0 taken 784 times.
✗ Branch 1 not taken.
|
784 | if(!p_igetl(&tile,f)) |
| 11000 | ✗ | return qe_invalid; | |
| 11001 | |||
| 11002 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 784 times.
|
784 | if(!p_getc(&flip,f)) |
| 11003 | ✗ | return qe_invalid; | |
| 11004 | |||
| 11005 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 784 times.
|
784 | if(!p_getc(&extend,f)) |
| 11006 | ✗ | return qe_invalid; | |
| 11007 | |||
| 11008 | 784 | setSprite(pullswordspr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 11009 | 784 | } | |
| 11010 | |||
| 11011 |
2/2✓ Branch 0 taken 784 times.
✓ Branch 1 taken 196 times.
|
980 | for(int32_t q = 0; q < 4; ++q) |
| 11012 | { | ||
| 11013 |
1/2✓ Branch 0 taken 784 times.
✗ Branch 1 not taken.
|
784 | if(!p_igetl(&tile,f)) |
| 11014 | ✗ | return qe_invalid; | |
| 11015 | |||
| 11016 |
1/2✓ Branch 0 taken 784 times.
✗ Branch 1 not taken.
|
784 | if(!p_getc(&flip,f)) |
| 11017 | ✗ | return qe_invalid; | |
| 11018 | |||
| 11019 |
1/2✓ Branch 0 taken 784 times.
✗ Branch 1 not taken.
|
784 | if(!p_getc(&extend,f)) |
| 11020 | ✗ | return qe_invalid; | |
| 11021 | |||
| 11022 | 784 | setSprite(readingspr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 11023 | 784 | } | |
| 11024 | |||
| 11025 |
2/2✓ Branch 0 taken 784 times.
✓ Branch 1 taken 196 times.
|
980 | for(int32_t q = 0; q < 4; ++q) |
| 11026 | { | ||
| 11027 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 784 times.
|
784 | if(!p_igetl(&tile,f)) |
| 11028 | ✗ | return qe_invalid; | |
| 11029 | |||
| 11030 |
1/2✓ Branch 0 taken 784 times.
✗ Branch 1 not taken.
|
784 | if(!p_getc(&flip,f)) |
| 11031 | ✗ | return qe_invalid; | |
| 11032 | |||
| 11033 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 784 times.
|
784 | if(!p_getc(&extend,f)) |
| 11034 | ✗ | return qe_invalid; | |
| 11035 | |||
| 11036 | 784 | setSprite(slash180spr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 11037 | 784 | } | |
| 11038 | |||
| 11039 |
2/2✓ Branch 0 taken 784 times.
✓ Branch 1 taken 196 times.
|
980 | for(int32_t q = 0; q < 4; ++q) |
| 11040 | { | ||
| 11041 |
1/2✓ Branch 0 taken 784 times.
✗ Branch 1 not taken.
|
784 | if(!p_igetl(&tile,f)) |
| 11042 | ✗ | return qe_invalid; | |
| 11043 | |||
| 11044 |
1/2✓ Branch 0 taken 784 times.
✗ Branch 1 not taken.
|
784 | if(!p_getc(&flip,f)) |
| 11045 | ✗ | return qe_invalid; | |
| 11046 | |||
| 11047 |
1/2✓ Branch 0 taken 784 times.
✗ Branch 1 not taken.
|
784 | if(!p_getc(&extend,f)) |
| 11048 | ✗ | return qe_invalid; | |
| 11049 | |||
| 11050 | 784 | setSprite(slashZ4spr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 11051 | 784 | } | |
| 11052 | |||
| 11053 |
2/2✓ Branch 0 taken 784 times.
✓ Branch 1 taken 196 times.
|
980 | for(int32_t q = 0; q < 4; ++q) |
| 11054 | { | ||
| 11055 |
1/2✓ Branch 0 taken 784 times.
✗ Branch 1 not taken.
|
784 | if(!p_igetl(&tile,f)) |
| 11056 | ✗ | return qe_invalid; | |
| 11057 | |||
| 11058 |
1/2✓ Branch 0 taken 784 times.
✗ Branch 1 not taken.
|
784 | if(!p_getc(&flip,f)) |
| 11059 | ✗ | return qe_invalid; | |
| 11060 | |||
| 11061 |
1/2✓ Branch 0 taken 784 times.
✗ Branch 1 not taken.
|
784 | if(!p_getc(&extend,f)) |
| 11062 | ✗ | return qe_invalid; | |
| 11063 | |||
| 11064 | 784 | setSprite(dashspr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 11065 | 784 | } | |
| 11066 | |||
| 11067 |
2/2✓ Branch 0 taken 784 times.
✓ Branch 1 taken 196 times.
|
980 | for(int32_t q = 0; q < 4; ++q) |
| 11068 | { | ||
| 11069 |
1/2✓ Branch 0 taken 784 times.
✗ Branch 1 not taken.
|
784 | if(!p_igetl(&tile,f)) |
| 11070 | ✗ | return qe_invalid; | |
| 11071 | |||
| 11072 |
1/2✓ Branch 0 taken 784 times.
✗ Branch 1 not taken.
|
784 | if(!p_getc(&flip,f)) |
| 11073 | ✗ | return qe_invalid; | |
| 11074 | |||
| 11075 |
1/2✓ Branch 0 taken 784 times.
✗ Branch 1 not taken.
|
784 | if(!p_getc(&extend,f)) |
| 11076 | ✗ | return qe_invalid; | |
| 11077 | |||
| 11078 | 784 | setSprite(bonkspr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 11079 | 784 | } | |
| 11080 | |||
| 11081 |
2/2✓ Branch 0 taken 588 times.
✓ Branch 1 taken 196 times.
|
784 | for(int32_t q = 0; q < 3; ++q) //Not directions; number of medallion sprs |
| 11082 | { | ||
| 11083 |
1/2✓ Branch 0 taken 588 times.
✗ Branch 1 not taken.
|
588 | if(!p_igetl(&tile,f)) |
| 11084 | ✗ | return qe_invalid; | |
| 11085 | |||
| 11086 |
1/2✓ Branch 0 taken 588 times.
✗ Branch 1 not taken.
|
588 | if(!p_getc(&flip,f)) |
| 11087 | ✗ | return qe_invalid; | |
| 11088 | |||
| 11089 |
1/2✓ Branch 0 taken 588 times.
✗ Branch 1 not taken.
|
588 | if(!p_getc(&extend,f)) |
| 11090 | ✗ | return qe_invalid; | |
| 11091 | |||
| 11092 | 588 | setSprite(medallionsprs[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 11093 | 588 | } | |
| 11094 | 196 | } | |
| 11095 | else | ||
| 11096 | { | ||
| 11097 | ✗ | memset(frozenspr, 0, sizeof(frozenspr)); | |
| 11098 | ✗ | memset(frozen_waterspr, 0, sizeof(frozen_waterspr)); | |
| 11099 | ✗ | memset(onfirespr, 0, sizeof(onfirespr)); | |
| 11100 | ✗ | memset(onfire_waterspr, 0, sizeof(onfire_waterspr)); | |
| 11101 | ✗ | memset(diggingspr, 0, sizeof(diggingspr)); | |
| 11102 | ✗ | memset(usingrodspr, 0, sizeof(usingrodspr)); | |
| 11103 | ✗ | memset(usingcanespr, 0, sizeof(usingcanespr)); | |
| 11104 | ✗ | memset(pushingspr, 0, sizeof(pushingspr)); | |
| 11105 | ✗ | memset(liftingspr, 0, sizeof(liftingspr)); | |
| 11106 | ✗ | memset(liftingwalkspr, 0, sizeof(liftingwalkspr)); | |
| 11107 | ✗ | memset(stunnedspr, 0, sizeof(stunnedspr)); | |
| 11108 | ✗ | memset(stunned_waterspr, 0, sizeof(stunned_waterspr)); | |
| 11109 | ✗ | memset(fallingspr, 0, sizeof(fallingspr)); | |
| 11110 | ✗ | memset(shockedspr, 0, sizeof(shockedspr)); | |
| 11111 | ✗ | memset(shocked_waterspr, 0, sizeof(shocked_waterspr)); | |
| 11112 | ✗ | memset(pullswordspr, 0, sizeof(pullswordspr)); | |
| 11113 | ✗ | memset(readingspr, 0, sizeof(readingspr)); | |
| 11114 | ✗ | memset(slash180spr, 0, sizeof(slash180spr)); | |
| 11115 | ✗ | memset(slashZ4spr, 0, sizeof(slashZ4spr)); | |
| 11116 | ✗ | memset(dashspr, 0, sizeof(dashspr)); | |
| 11117 | ✗ | memset(bonkspr, 0, sizeof(bonkspr)); | |
| 11118 | ✗ | memset(medallionsprs, 0, sizeof(medallionsprs)); | |
| 11119 | ✗ | memset(holdspr[0][2], 0, sizeof(holdspr[0][2])); //Sword hold (Land) | |
| 11120 | ✗ | memset(holdspr[1][2], 0, sizeof(holdspr[1][2])); //Sword hold (Water) | |
| 11121 | ✗ | for(int32_t q = 0; q < 4; ++q) | |
| 11122 | { | ||
| 11123 | ✗ | for(int32_t p = 0; p < 3; ++p) | |
| 11124 | { | ||
| 11125 | ✗ | drowningspr[q][p] = divespr[q][p]; | |
| 11126 | ✗ | drowning_lavaspr[q][p] = divespr[q][p]; | |
| 11127 | ✗ | } | |
| 11128 | ✗ | } | |
| 11129 | } | ||
| 11130 |
1/2✓ Branch 0 taken 196 times.
✗ Branch 1 not taken.
|
196 | if (v_herosprites > 8) |
| 11131 | { | ||
| 11132 |
2/2✓ Branch 0 taken 784 times.
✓ Branch 1 taken 196 times.
|
980 | for(int32_t q = 0; q < 4; ++q) |
| 11133 | { | ||
| 11134 |
1/2✓ Branch 0 taken 784 times.
✗ Branch 1 not taken.
|
784 | if(!p_igetl(&tile,f)) |
| 11135 | ✗ | return qe_invalid; | |
| 11136 | |||
| 11137 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 784 times.
|
784 | if(!p_getc(&flip,f)) |
| 11138 | ✗ | return qe_invalid; | |
| 11139 | |||
| 11140 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 784 times.
|
784 | if(!p_getc(&extend,f)) |
| 11141 | ✗ | return qe_invalid; | |
| 11142 | |||
| 11143 | 784 | setSprite(sideswimspr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 11144 | 784 | } | |
| 11145 | 196 | } | |
| 11146 | else | ||
| 11147 | { | ||
| 11148 | ✗ | memset(sideswimspr, 0, sizeof(sideswimspr)); | |
| 11149 | } | ||
| 11150 |
1/2✓ Branch 0 taken 196 times.
✗ Branch 1 not taken.
|
196 | if (v_herosprites > 9) |
| 11151 | { | ||
| 11152 |
2/2✓ Branch 0 taken 784 times.
✓ Branch 1 taken 196 times.
|
980 | for(int32_t q = 0; q < 4; ++q) |
| 11153 | { | ||
| 11154 |
1/2✓ Branch 0 taken 784 times.
✗ Branch 1 not taken.
|
784 | if(!p_igetl(&tile,f)) |
| 11155 | ✗ | return qe_invalid; | |
| 11156 | |||
| 11157 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 784 times.
|
784 | if(!p_getc(&flip,f)) |
| 11158 | ✗ | return qe_invalid; | |
| 11159 | |||
| 11160 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 784 times.
|
784 | if(!p_getc(&extend,f)) |
| 11161 | ✗ | return qe_invalid; | |
| 11162 | |||
| 11163 | 784 | setSprite(sideswimslashspr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 11164 | 784 | } | |
| 11165 |
2/2✓ Branch 0 taken 784 times.
✓ Branch 1 taken 196 times.
|
980 | for(int32_t q = 0; q < 4; ++q) |
| 11166 | { | ||
| 11167 |
1/2✓ Branch 0 taken 784 times.
✗ Branch 1 not taken.
|
784 | if(!p_igetl(&tile,f)) |
| 11168 | ✗ | return qe_invalid; | |
| 11169 | |||
| 11170 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 784 times.
|
784 | if(!p_getc(&flip,f)) |
| 11171 | ✗ | return qe_invalid; | |
| 11172 | |||
| 11173 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 784 times.
|
784 | if(!p_getc(&extend,f)) |
| 11174 | ✗ | return qe_invalid; | |
| 11175 | |||
| 11176 | 784 | setSprite(sideswimstabspr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 11177 | 784 | } | |
| 11178 |
2/2✓ Branch 0 taken 784 times.
✓ Branch 1 taken 196 times.
|
980 | for(int32_t q = 0; q < 4; ++q) |
| 11179 | { | ||
| 11180 |
1/2✓ Branch 0 taken 784 times.
✗ Branch 1 not taken.
|
784 | if(!p_igetl(&tile,f)) |
| 11181 | ✗ | return qe_invalid; | |
| 11182 | |||
| 11183 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 784 times.
|
784 | if(!p_getc(&flip,f)) |
| 11184 | ✗ | return qe_invalid; | |
| 11185 | |||
| 11186 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 784 times.
|
784 | if(!p_getc(&extend,f)) |
| 11187 | ✗ | return qe_invalid; | |
| 11188 | |||
| 11189 | 784 | setSprite(sideswimpoundspr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 11190 | 784 | } | |
| 11191 |
2/2✓ Branch 0 taken 784 times.
✓ Branch 1 taken 196 times.
|
980 | for(int32_t q = 0; q < 4; ++q) |
| 11192 | { | ||
| 11193 |
1/2✓ Branch 0 taken 784 times.
✗ Branch 1 not taken.
|
784 | if(!p_igetl(&tile,f)) |
| 11194 | ✗ | return qe_invalid; | |
| 11195 | |||
| 11196 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 784 times.
|
784 | if(!p_getc(&flip,f)) |
| 11197 | ✗ | return qe_invalid; | |
| 11198 | |||
| 11199 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 784 times.
|
784 | if(!p_getc(&extend,f)) |
| 11200 | ✗ | return qe_invalid; | |
| 11201 | |||
| 11202 | 784 | setSprite(sideswimchargespr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 11203 | 784 | } | |
| 11204 | 196 | } | |
| 11205 | else | ||
| 11206 | { | ||
| 11207 | ✗ | memset(sideswimslashspr, 0, sizeof(sideswimslashspr)); | |
| 11208 | ✗ | memset(sideswimstabspr, 0, sizeof(sideswimstabspr)); | |
| 11209 | ✗ | memset(sideswimpoundspr, 0, sizeof(sideswimpoundspr)); | |
| 11210 | ✗ | memset(sideswimchargespr, 0, sizeof(sideswimchargespr)); | |
| 11211 | } | ||
| 11212 |
1/2✓ Branch 0 taken 196 times.
✗ Branch 1 not taken.
|
196 | if (v_herosprites > 10) |
| 11213 | { | ||
| 11214 |
2/2✓ Branch 0 taken 784 times.
✓ Branch 1 taken 196 times.
|
980 | for(int32_t q = 0; q < 4; ++q) |
| 11215 | { | ||
| 11216 | int32_t hmr; | ||
| 11217 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 784 times.
|
784 | if(!p_igetl(&hmr,f)) |
| 11218 | ✗ | return qe_invalid; | |
| 11219 | |||
| 11220 | 784 | hammeroffsets[q] = hmr; | |
| 11221 | 784 | } | |
| 11222 | 196 | } | |
| 11223 | else | ||
| 11224 | { | ||
| 11225 | ✗ | for(int32_t q = 0; q < 4; ++q) hammeroffsets[q] = 0; | |
| 11226 | } | ||
| 11227 |
1/2✓ Branch 0 taken 196 times.
✗ Branch 1 not taken.
|
196 | if (v_herosprites > 11) |
| 11228 | { | ||
| 11229 |
2/2✓ Branch 0 taken 588 times.
✓ Branch 1 taken 196 times.
|
784 | for(int32_t q = 0; q < 3; ++q) |
| 11230 | { | ||
| 11231 |
1/2✓ Branch 0 taken 588 times.
✗ Branch 1 not taken.
|
588 | if(!p_igetl(&tile,f)) |
| 11232 | ✗ | return qe_invalid; | |
| 11233 | |||
| 11234 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 588 times.
|
588 | if(!p_getc(&flip,f)) |
| 11235 | ✗ | return qe_invalid; | |
| 11236 | |||
| 11237 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 588 times.
|
588 | if(!p_getc(&extend,f)) |
| 11238 | ✗ | return qe_invalid; | |
| 11239 | |||
| 11240 | 588 | setSprite(sideswimholdspr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 11241 | 588 | } | |
| 11242 | 196 | } | |
| 11243 | else | ||
| 11244 | { | ||
| 11245 | ✗ | memset(sideswimholdspr, 0, sizeof(sideswimholdspr)); | |
| 11246 | } | ||
| 11247 |
1/2✓ Branch 0 taken 196 times.
✗ Branch 1 not taken.
|
196 | if (v_herosprites > 12) |
| 11248 | { | ||
| 11249 |
1/2✓ Branch 0 taken 196 times.
✗ Branch 1 not taken.
|
196 | if(!p_igetl(&tile,f)) |
| 11250 | ✗ | return qe_invalid; | |
| 11251 | |||
| 11252 |
1/2✓ Branch 0 taken 196 times.
✗ Branch 1 not taken.
|
196 | if(!p_getc(&flip,f)) |
| 11253 | ✗ | return qe_invalid; | |
| 11254 | |||
| 11255 |
1/2✓ Branch 0 taken 196 times.
✗ Branch 1 not taken.
|
196 | if(!p_getc(&extend,f)) |
| 11256 | ✗ | return qe_invalid; | |
| 11257 | 196 | setSprite(sideswimcastingspr, int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 11258 | |||
| 11259 | 196 | } | |
| 11260 | else | ||
| 11261 | { | ||
| 11262 | ✗ | memset(sideswimcastingspr, 0, sizeof(sideswimcastingspr)); | |
| 11263 | } | ||
| 11264 |
1/2✓ Branch 0 taken 196 times.
✗ Branch 1 not taken.
|
196 | if (v_herosprites > 13) |
| 11265 | { | ||
| 11266 |
2/2✓ Branch 0 taken 784 times.
✓ Branch 1 taken 196 times.
|
980 | for(int32_t q = 0; q < 4; ++q) |
| 11267 | { | ||
| 11268 |
1/2✓ Branch 0 taken 784 times.
✗ Branch 1 not taken.
|
784 | if(!p_igetl(&tile,f)) |
| 11269 | ✗ | return qe_invalid; | |
| 11270 | |||
| 11271 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 784 times.
|
784 | if(!p_getc(&flip,f)) |
| 11272 | ✗ | return qe_invalid; | |
| 11273 | |||
| 11274 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 784 times.
|
784 | if(!p_getc(&extend,f)) |
| 11275 | ✗ | return qe_invalid; | |
| 11276 | |||
| 11277 | 784 | setSprite(sidedrowningspr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 11278 | 784 | } | |
| 11279 | 196 | } | |
| 11280 | else | ||
| 11281 | { | ||
| 11282 | ✗ | memset(sidedrowningspr, 0, sizeof(sidedrowningspr)); | |
| 11283 | } | ||
| 11284 |
1/2✓ Branch 0 taken 196 times.
✗ Branch 1 not taken.
|
196 | if (v_herosprites > 14) |
| 11285 | { | ||
| 11286 |
2/2✓ Branch 0 taken 784 times.
✓ Branch 1 taken 196 times.
|
980 | for(int32_t q = 0; q < 4; ++q) |
| 11287 | { | ||
| 11288 |
1/2✓ Branch 0 taken 784 times.
✗ Branch 1 not taken.
|
784 | if(!p_igetl(&tile,f)) |
| 11289 | ✗ | return qe_invalid; | |
| 11290 | |||
| 11291 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 784 times.
|
784 | if(!p_getc(&flip,f)) |
| 11292 | ✗ | return qe_invalid; | |
| 11293 | |||
| 11294 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 784 times.
|
784 | if(!p_getc(&extend,f)) |
| 11295 | ✗ | return qe_invalid; | |
| 11296 | |||
| 11297 | 784 | setSprite(revslashspr[q], int32_t(tile), int32_t(flip), int32_t(extend)); | |
| 11298 | 784 | } | |
| 11299 | 196 | } | |
| 11300 | else | ||
| 11301 | { | ||
| 11302 | ✗ | memset(revslashspr, 0, sizeof(revslashspr)); | |
| 11303 | } | ||
| 11304 |
1/2✓ Branch 0 taken 196 times.
✗ Branch 1 not taken.
|
196 | if (v_herosprites > 7) |
| 11305 | { | ||
| 11306 | 196 | int32_t num_defense = wMax; | |
| 11307 | 196 | byte def = 0; | |
| 11308 | |||
| 11309 | //Set num_defense accordingly if changes to enum require version upgrade - Jman | ||
| 11310 | /*if(v_herosprites > [x]) | ||
| 11311 | * { | ||
| 11312 | * num_defense = 146 //value of wMax on version 8 | ||
| 11313 | * } | ||
| 11314 | */ | ||
| 11315 | |||
| 11316 |
2/2✓ Branch 0 taken 28616 times.
✓ Branch 1 taken 196 times.
|
28812 | for (int32_t q = 0; q < num_defense; q++) |
| 11317 | { | ||
| 11318 |
1/2✓ Branch 0 taken 28616 times.
✗ Branch 1 not taken.
|
28616 | if (!p_getc(&def, f)) |
| 11319 | ✗ | return qe_invalid; | |
| 11320 | |||
| 11321 | 28616 | hero_defenses[q] = def; | |
| 11322 | 28616 | } | |
| 11323 | 196 | } | |
| 11324 | else | ||
| 11325 | { | ||
| 11326 | ✗ | int32_t num_defense = wMax; | |
| 11327 | ✗ | for (int32_t q = 0; q < num_defense; q++) | |
| 11328 | { | ||
| 11329 | ✗ | hero_defenses[q] = 0; | |
| 11330 | ✗ | } | |
| 11331 | } | ||
| 11332 | 196 | } | |
| 11333 | |||
| 11334 |
2/2✓ Branch 0 taken 186 times.
✓ Branch 1 taken 10 times.
|
196 | if(FFCore.quest_format[vInitData] < 34) |
| 11335 | { | ||
| 11336 | 10 | bool fastswim = zinit.hero_swim_speed > 60; | |
| 11337 | // '2/3' or '1/2' | ||
| 11338 | 10 | zinit.hero_swim_mult = fastswim ? 2 : 1; | |
| 11339 | 10 | zinit.hero_swim_div = fastswim ? 3 : 2; | |
| 11340 | 10 | } | |
| 11341 | 196 | return 0; | |
| 11342 | 196 | } | |
| 11343 | |||
| 11344 | |||
| 11345 | 396 | int32_t readherosprites(PACKFILE *f, zquestheader *Header) | |
| 11346 | { | ||
| 11347 | //these are here to bypass compiler warnings about unused arguments | ||
| 11348 | 396 | Header=Header; | |
| 11349 | |||
| 11350 | dword dummy; | ||
| 11351 | 396 | word s_version=0; | |
| 11352 | |||
| 11353 | //section version info | ||
| 11354 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 396 times.
|
396 | if(!p_igetw(&s_version,f)) |
| 11355 | { | ||
| 11356 | ✗ | return qe_invalid; | |
| 11357 | } | ||
| 11358 | |||
| 11359 | 396 | FFCore.quest_format[vHeroSprites] = s_version; | |
| 11360 | |||
| 11361 |
1/2✓ Branch 0 taken 396 times.
✗ Branch 1 not taken.
|
396 | if(!read_deprecated_section_cversion(f)) |
| 11362 | { | ||
| 11363 | ✗ | return qe_invalid; | |
| 11364 | } | ||
| 11365 | |||
| 11366 | //section size | ||
| 11367 |
1/2✓ Branch 0 taken 396 times.
✗ Branch 1 not taken.
|
396 | if(!p_igetl(&dummy,f)) |
| 11368 | { | ||
| 11369 | ✗ | return qe_invalid; | |
| 11370 | } | ||
| 11371 |
2/2✓ Branch 0 taken 196 times.
✓ Branch 1 taken 200 times.
|
396 | if ( s_version >= 6 ) |
| 11372 | { | ||
| 11373 | 196 | return readherosprites3(f, s_version); | |
| 11374 | } | ||
| 11375 | 200 | else return readherosprites2(f, s_version); | |
| 11376 | 396 | } | |
| 11377 | |||
| 11378 | 216 | int32_t read_old_subscreens(PACKFILE *f, word s_version) | |
| 11379 | { | ||
| 11380 | 216 | subscreens_active.clear(); | |
| 11381 | 216 | subscreens_passive.clear(); | |
| 11382 | 216 | subscreens_overlay.clear(); | |
| 11383 |
2/2✓ Branch 0 taken 27648 times.
✓ Branch 1 taken 216 times.
|
27864 | for(int32_t i=0; i<MAXCUSTOMSUBSCREENS; i++) |
| 11384 | { | ||
| 11385 | subscreen_group g; | ||
| 11386 | 27648 | memset(&g,0,sizeof(subscreen_group)); | |
| 11387 | 27648 | int32_t ret = read_one_old_subscreen(f, &g, s_version); | |
| 11388 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 27648 times.
|
27648 | if(ret!=0) |
| 11389 | ✗ | return ret; | |
| 11390 |
2/2✓ Branch 0 taken 1101 times.
✓ Branch 1 taken 26547 times.
|
27648 | if(g.objects[0].type == ssoNULL) continue; |
| 11391 |
2/2✓ Branch 0 taken 465 times.
✓ Branch 1 taken 636 times.
|
1101 | auto& vec = g.ss_type == sstPASSIVE ? subscreens_passive : subscreens_active; |
| 11392 | 1101 | ZCSubscreen& sub = vec.emplace_back(); | |
| 11393 | 1101 | sub.load_old(g); | |
| 11394 | 1101 | } | |
| 11395 | |||
| 11396 | 216 | return 0; | |
| 11397 | 216 | } | |
| 11398 | |||
| 11399 | 27648 | int32_t read_one_old_subscreen(PACKFILE *f, subscreen_group* g, word s_version) | |
| 11400 | { | ||
| 11401 | 27648 | int32_t numsub=0; | |
| 11402 | 27648 | byte temp_ss=0; | |
| 11403 | subscreen_object temp_sub_stack; | ||
| 11404 | 27648 | subscreen_object *temp_sub = &temp_sub_stack; | |
| 11405 | |||
| 11406 | char tempname[64]; | ||
| 11407 | |||
| 11408 | // FWIW I never saw anything bigger than 20. | ||
| 11409 | #define MAX_DP1_LEN 1024 | ||
| 11410 | char tempdp1[MAX_DP1_LEN]; | ||
| 11411 | |||
| 11412 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 27648 times.
|
27648 | if(!pfread(tempname,64,f)) |
| 11413 | { | ||
| 11414 | ✗ | return qe_invalid; | |
| 11415 | } | ||
| 11416 | |||
| 11417 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 27648 times.
|
27648 | if(s_version > 1) |
| 11418 | { | ||
| 11419 |
1/2✓ Branch 0 taken 27648 times.
✗ Branch 1 not taken.
|
27648 | if(!p_getc(&temp_ss,f)) |
| 11420 | { | ||
| 11421 | ✗ | return qe_invalid; | |
| 11422 | } | ||
| 11423 | 27648 | } | |
| 11424 | |||
| 11425 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 27648 times.
|
27648 | if(s_version < 4) |
| 11426 | { | ||
| 11427 | ✗ | uint8_t tmp=0; | |
| 11428 | |||
| 11429 | ✗ | if(!p_getc(&tmp,f)) | |
| 11430 | { | ||
| 11431 | ✗ | return qe_invalid; | |
| 11432 | } | ||
| 11433 | |||
| 11434 | ✗ | numsub = (int32_t)tmp; | |
| 11435 | ✗ | } | |
| 11436 | else | ||
| 11437 | { | ||
| 11438 | word tmp; | ||
| 11439 | |||
| 11440 |
1/2✓ Branch 0 taken 27648 times.
✗ Branch 1 not taken.
|
27648 | if(!p_igetw(&tmp, f)) |
| 11441 | { | ||
| 11442 | ✗ | return qe_invalid; | |
| 11443 | } | ||
| 11444 | |||
| 11445 | 27648 | numsub = (int32_t)tmp; | |
| 11446 | } | ||
| 11447 | |||
| 11448 | int32_t j; | ||
| 11449 | |||
| 11450 |
3/4✗ Branch 0 not taken.
✓ Branch 1 taken 71160 times.
✓ Branch 2 taken 43512 times.
✓ Branch 3 taken 27648 times.
|
71160 | for(j=0; (j<MAXSUBSCREENITEMS&&j<numsub); j++) |
| 11451 | { | ||
| 11452 | 43512 | memset(temp_sub,0,sizeof(subscreen_object)); | |
| 11453 | |||
| 11454 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 43512 times.
|
43512 | switch(g->objects[j].type) |
| 11455 | { | ||
| 11456 | case ssoTEXT: | ||
| 11457 | case ssoTEXTBOX: | ||
| 11458 | case ssoCURRENTITEMTEXT: | ||
| 11459 | case ssoCURRENTITEMCLASSTEXT: | ||
| 11460 | ✗ | if(g->objects[j].dp1 != NULL) delete [](char *)g->objects[j].dp1; | |
| 11461 | |||
| 11462 | //fall through | ||
| 11463 | default: | ||
| 11464 | 43512 | memset(&g->objects[j],0,sizeof(subscreen_object)); | |
| 11465 | 43512 | break; | |
| 11466 | } | ||
| 11467 | |||
| 11468 |
1/2✓ Branch 0 taken 43512 times.
✗ Branch 1 not taken.
|
43512 | if(!p_getc(&(temp_sub->type),f)) |
| 11469 | ✗ | return qe_invalid; | |
| 11470 | |||
| 11471 |
1/2✓ Branch 0 taken 43512 times.
✗ Branch 1 not taken.
|
43512 | if(!p_getc(&(temp_sub->pos),f)) |
| 11472 | ✗ | return qe_invalid; | |
| 11473 | |||
| 11474 |
1/2✓ Branch 0 taken 43512 times.
✗ Branch 1 not taken.
|
43512 | if(s_version < 5) |
| 11475 | { | ||
| 11476 | ✗ | switch(temp_sub->pos) | |
| 11477 | { | ||
| 11478 | case 0: | ||
| 11479 | ✗ | temp_sub->pos = sspUP | sspDOWN | sspSCROLLING; | |
| 11480 | ✗ | break; | |
| 11481 | |||
| 11482 | case 1: | ||
| 11483 | ✗ | temp_sub->pos = sspUP; | |
| 11484 | ✗ | break; | |
| 11485 | |||
| 11486 | case 2: | ||
| 11487 | ✗ | temp_sub->pos = sspDOWN; | |
| 11488 | ✗ | break; | |
| 11489 | |||
| 11490 | default: | ||
| 11491 | ✗ | temp_sub->pos = 0; | |
| 11492 | ✗ | } | |
| 11493 | ✗ | } | |
| 11494 | |||
| 11495 |
1/2✓ Branch 0 taken 43512 times.
✗ Branch 1 not taken.
|
43512 | if(!p_igetw(&(temp_sub->x),f)) |
| 11496 | ✗ | return qe_invalid; | |
| 11497 | |||
| 11498 |
1/2✓ Branch 0 taken 43512 times.
✗ Branch 1 not taken.
|
43512 | if(!p_igetw(&(temp_sub->y),f)) |
| 11499 | ✗ | return qe_invalid; | |
| 11500 | |||
| 11501 |
1/2✓ Branch 0 taken 43512 times.
✗ Branch 1 not taken.
|
43512 | if(!p_igetw(&(temp_sub->w),f)) |
| 11502 | ✗ | return qe_invalid; | |
| 11503 | |||
| 11504 |
1/2✓ Branch 0 taken 43512 times.
✗ Branch 1 not taken.
|
43512 | if(!p_igetw(&(temp_sub->h),f)) |
| 11505 | ✗ | return qe_invalid; | |
| 11506 | |||
| 11507 |
1/2✓ Branch 0 taken 43512 times.
✗ Branch 1 not taken.
|
43512 | if(!p_getc(&(temp_sub->colortype1),f)) |
| 11508 | ✗ | return qe_invalid; | |
| 11509 | |||
| 11510 |
1/2✓ Branch 0 taken 43512 times.
✗ Branch 1 not taken.
|
43512 | if(!p_igetw(&(temp_sub->color1),f)) |
| 11511 | ✗ | return qe_invalid; | |
| 11512 | |||
| 11513 |
1/2✓ Branch 0 taken 43512 times.
✗ Branch 1 not taken.
|
43512 | if(!p_getc(&(temp_sub->colortype2),f)) |
| 11514 | ✗ | return qe_invalid; | |
| 11515 | |||
| 11516 |
1/2✓ Branch 0 taken 43512 times.
✗ Branch 1 not taken.
|
43512 | if(!p_igetw(&(temp_sub->color2),f)) |
| 11517 | ✗ | return qe_invalid; | |
| 11518 | |||
| 11519 |
1/2✓ Branch 0 taken 43512 times.
✗ Branch 1 not taken.
|
43512 | if(!p_getc(&(temp_sub->colortype3),f)) |
| 11520 | ✗ | return qe_invalid; | |
| 11521 | |||
| 11522 |
1/2✓ Branch 0 taken 43512 times.
✗ Branch 1 not taken.
|
43512 | if(!p_igetw(&(temp_sub->color3),f)) |
| 11523 | ✗ | return qe_invalid; | |
| 11524 | |||
| 11525 |
1/2✓ Branch 0 taken 43512 times.
✗ Branch 1 not taken.
|
43512 | if(!p_igetd(&(temp_sub->d1),f)) |
| 11526 | ✗ | return qe_invalid; | |
| 11527 | |||
| 11528 |
1/2✓ Branch 0 taken 43512 times.
✗ Branch 1 not taken.
|
43512 | if(!p_igetd(&(temp_sub->d2),f)) |
| 11529 | ✗ | return qe_invalid; | |
| 11530 | |||
| 11531 |
1/2✓ Branch 0 taken 43512 times.
✗ Branch 1 not taken.
|
43512 | if(!p_igetd(&(temp_sub->d3),f)) |
| 11532 | ✗ | return qe_invalid; | |
| 11533 | |||
| 11534 |
1/2✓ Branch 0 taken 43512 times.
✗ Branch 1 not taken.
|
43512 | if(!p_igetd(&(temp_sub->d4),f)) |
| 11535 | ✗ | return qe_invalid; | |
| 11536 | |||
| 11537 |
1/2✓ Branch 0 taken 43512 times.
✗ Branch 1 not taken.
|
43512 | if(!p_igetd(&(temp_sub->d5),f)) |
| 11538 | ✗ | return qe_invalid; | |
| 11539 | |||
| 11540 |
1/2✓ Branch 0 taken 43512 times.
✗ Branch 1 not taken.
|
43512 | if(!p_igetd(&(temp_sub->d6),f)) |
| 11541 | ✗ | return qe_invalid; | |
| 11542 | |||
| 11543 |
1/2✓ Branch 0 taken 43512 times.
✗ Branch 1 not taken.
|
43512 | if(!p_igetd(&(temp_sub->d7),f)) |
| 11544 | ✗ | return qe_invalid; | |
| 11545 | |||
| 11546 |
1/2✓ Branch 0 taken 43512 times.
✗ Branch 1 not taken.
|
43512 | if(!p_igetd(&(temp_sub->d8),f)) |
| 11547 | ✗ | return qe_invalid; | |
| 11548 | |||
| 11549 |
1/2✓ Branch 0 taken 43512 times.
✗ Branch 1 not taken.
|
43512 | if(!p_igetd(&(temp_sub->d9),f)) |
| 11550 | ✗ | return qe_invalid; | |
| 11551 | |||
| 11552 |
1/2✓ Branch 0 taken 43512 times.
✗ Branch 1 not taken.
|
43512 | if(!p_igetd(&(temp_sub->d10),f)) |
| 11553 | ✗ | return qe_invalid; | |
| 11554 | |||
| 11555 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 43512 times.
|
43512 | if(s_version < 2) |
| 11556 | { | ||
| 11557 | ✗ | if(!p_igetl(&(temp_sub->speed),f)) | |
| 11558 | ✗ | return qe_invalid; | |
| 11559 | |||
| 11560 | ✗ | if(!p_igetl(&(temp_sub->delay),f)) | |
| 11561 | ✗ | return qe_invalid; | |
| 11562 | |||
| 11563 | ✗ | if(!p_igetl(&(temp_sub->frame),f)) | |
| 11564 | ✗ | return qe_invalid; | |
| 11565 | ✗ | } | |
| 11566 | else | ||
| 11567 | { | ||
| 11568 |
1/2✓ Branch 0 taken 43512 times.
✗ Branch 1 not taken.
|
43512 | if(!p_getc(&(temp_sub->speed),f)) |
| 11569 | ✗ | return qe_invalid; | |
| 11570 | |||
| 11571 |
1/2✓ Branch 0 taken 43512 times.
✗ Branch 1 not taken.
|
43512 | if(!p_getc(&(temp_sub->delay),f)) |
| 11572 | ✗ | return qe_invalid; | |
| 11573 | |||
| 11574 |
1/2✓ Branch 0 taken 43512 times.
✗ Branch 1 not taken.
|
43512 | if(!p_igetw(&(temp_sub->frame),f)) |
| 11575 | ✗ | return qe_invalid; | |
| 11576 | } | ||
| 11577 | |||
| 11578 | 43512 | int32_t temp_size=0; | |
| 11579 | |||
| 11580 | // bool deletets = false; | ||
| 11581 |
4/4✓ Branch 0 taken 19216 times.
✓ Branch 1 taken 3354 times.
✓ Branch 2 taken 20700 times.
✓ Branch 3 taken 242 times.
|
43512 | switch(temp_sub->type) |
| 11582 | { | ||
| 11583 | case ssoTEXT: | ||
| 11584 | case ssoTEXTBOX: | ||
| 11585 | case ssoCURRENTITEMTEXT: | ||
| 11586 | case ssoCURRENTITEMCLASSTEXT: | ||
| 11587 | { | ||
| 11588 | word temptempsize; | ||
| 11589 | |||
| 11590 |
1/2✓ Branch 0 taken 3354 times.
✗ Branch 1 not taken.
|
3354 | if(!p_igetw(&temptempsize,f)) |
| 11591 | { | ||
| 11592 | ✗ | return qe_invalid; | |
| 11593 | } | ||
| 11594 | |||
| 11595 | //temptempsize = temp1 + (temp2 << 8); | ||
| 11596 | 3354 | temp_size = (int32_t)temptempsize; | |
| 11597 | 3354 | uint32_t char_length = temp_size+2; | |
| 11598 |
1/2✓ Branch 0 taken 3354 times.
✗ Branch 1 not taken.
|
3354 | if (char_length > MAX_DP1_LEN) |
| 11599 | { | ||
| 11600 | ✗ | return qe_invalid; | |
| 11601 | } | ||
| 11602 | 3354 | tempdp1[char_length - 1] = '\0'; | |
| 11603 | |||
| 11604 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 3354 times.
|
3354 | if(temp_size) |
| 11605 |
1/2✓ Branch 0 taken 3354 times.
✗ Branch 1 not taken.
|
3354 | if(!pfread(tempdp1,temp_size+1,f)) |
| 11606 | ✗ | return qe_invalid; | |
| 11607 | 3354 | break; | |
| 11608 | } | ||
| 11609 | |||
| 11610 | case ssoLIFEMETER: | ||
| 11611 |
1/2✓ Branch 0 taken 242 times.
✗ Branch 1 not taken.
|
242 | if(get_bit(deprecated_rules, 12) != 0) // qr_24HC |
| 11612 | ✗ | temp_sub->d3 = 1; | |
| 11613 | |||
| 11614 |
1/2✓ Branch 0 taken 242 times.
✗ Branch 1 not taken.
|
242 | if(!p_getc(&(temp_sub->dp1),f)) |
| 11615 | ✗ | return qe_invalid; | |
| 11616 | |||
| 11617 | 242 | break; | |
| 11618 | |||
| 11619 | |||
| 11620 | case ssoCURRENTITEM: | ||
| 11621 | |||
| 11622 |
1/2✓ Branch 0 taken 19216 times.
✗ Branch 1 not taken.
|
19216 | if(s_version < 6) |
| 11623 | { | ||
| 11624 | ✗ | switch(temp_sub->d1) | |
| 11625 | { | ||
| 11626 | case ssiBOMB: | ||
| 11627 | ✗ | temp_sub->d1 = itype_bomb; | |
| 11628 | ✗ | break; | |
| 11629 | |||
| 11630 | case ssiSWORD: | ||
| 11631 | ✗ | temp_sub->d1 = itype_sword; | |
| 11632 | ✗ | break; | |
| 11633 | |||
| 11634 | case ssiSHIELD: | ||
| 11635 | ✗ | temp_sub->d1 = itype_shield; | |
| 11636 | ✗ | break; | |
| 11637 | |||
| 11638 | case ssiCANDLE: | ||
| 11639 | ✗ | temp_sub->d1 = itype_candle; | |
| 11640 | ✗ | break; | |
| 11641 | |||
| 11642 | case ssiLETTER: | ||
| 11643 | ✗ | temp_sub->d1 = itype_letter; | |
| 11644 | ✗ | break; | |
| 11645 | |||
| 11646 | case ssiPOTION: | ||
| 11647 | ✗ | temp_sub->d1 = itype_potion; | |
| 11648 | ✗ | break; | |
| 11649 | |||
| 11650 | case ssiLETTERPOTION: | ||
| 11651 | ✗ | temp_sub->d1 = itype_letterpotion; | |
| 11652 | ✗ | break; | |
| 11653 | |||
| 11654 | case ssiBOW: | ||
| 11655 | ✗ | temp_sub->d1 = itype_bow; | |
| 11656 | ✗ | break; | |
| 11657 | |||
| 11658 | case ssiARROW: | ||
| 11659 | ✗ | temp_sub->d1 = itype_arrow; | |
| 11660 | ✗ | break; | |
| 11661 | |||
| 11662 | case ssiBOWANDARROW: | ||
| 11663 | ✗ | temp_sub->d1 = itype_bowandarrow; | |
| 11664 | ✗ | break; | |
| 11665 | |||
| 11666 | case ssiBAIT: | ||
| 11667 | ✗ | temp_sub->d1 = itype_bait; | |
| 11668 | ✗ | break; | |
| 11669 | |||
| 11670 | case ssiRING: | ||
| 11671 | ✗ | temp_sub->d1 = itype_ring; | |
| 11672 | ✗ | break; | |
| 11673 | |||
| 11674 | case ssiBRACELET: | ||
| 11675 | ✗ | temp_sub->d1 = itype_bracelet; | |
| 11676 | ✗ | break; | |
| 11677 | |||
| 11678 | case ssiMAP: | ||
| 11679 | ✗ | temp_sub->d1 = itype_map; | |
| 11680 | ✗ | break; | |
| 11681 | |||
| 11682 | case ssiCOMPASS: | ||
| 11683 | ✗ | temp_sub->d1 = itype_compass; | |
| 11684 | ✗ | break; | |
| 11685 | |||
| 11686 | case ssiBOSSKEY: | ||
| 11687 | ✗ | temp_sub->d1 = itype_bosskey; | |
| 11688 | ✗ | break; | |
| 11689 | |||
| 11690 | case ssiMAGICKEY: | ||
| 11691 | ✗ | temp_sub->d1 = itype_magickey; | |
| 11692 | ✗ | break; | |
| 11693 | |||
| 11694 | case ssiBRANG: | ||
| 11695 | ✗ | temp_sub->d1 = itype_brang; | |
| 11696 | ✗ | break; | |
| 11697 | |||
| 11698 | case ssiWAND: | ||
| 11699 | ✗ | temp_sub->d1 = itype_wand; | |
| 11700 | ✗ | break; | |
| 11701 | |||
| 11702 | case ssiRAFT: | ||
| 11703 | ✗ | temp_sub->d1 = itype_raft; | |
| 11704 | ✗ | break; | |
| 11705 | |||
| 11706 | case ssiLADDER: | ||
| 11707 | ✗ | temp_sub->d1 = itype_ladder; | |
| 11708 | ✗ | break; | |
| 11709 | |||
| 11710 | case ssiWHISTLE: | ||
| 11711 | ✗ | temp_sub->d1 = itype_whistle; | |
| 11712 | ✗ | break; | |
| 11713 | |||
| 11714 | case ssiBOOK: | ||
| 11715 | ✗ | temp_sub->d1 = itype_book; | |
| 11716 | ✗ | break; | |
| 11717 | |||
| 11718 | case ssiWALLET: | ||
| 11719 | ✗ | temp_sub->d1 = itype_wallet; | |
| 11720 | ✗ | break; | |
| 11721 | |||
| 11722 | case ssiSBOMB: | ||
| 11723 | ✗ | temp_sub->d1 = itype_sbomb; | |
| 11724 | ✗ | break; | |
| 11725 | |||
| 11726 | case ssiHCPIECE: | ||
| 11727 | ✗ | temp_sub->d1 = itype_heartpiece; | |
| 11728 | ✗ | break; | |
| 11729 | |||
| 11730 | case ssiAMULET: | ||
| 11731 | ✗ | temp_sub->d1 = itype_amulet; | |
| 11732 | ✗ | break; | |
| 11733 | |||
| 11734 | case ssiFLIPPERS: | ||
| 11735 | ✗ | temp_sub->d1 = itype_flippers; | |
| 11736 | ✗ | break; | |
| 11737 | |||
| 11738 | case ssiHOOKSHOT: | ||
| 11739 | ✗ | temp_sub->d1 = itype_hookshot; | |
| 11740 | ✗ | break; | |
| 11741 | |||
| 11742 | case ssiLENS: | ||
| 11743 | ✗ | temp_sub->d1 = itype_lens; | |
| 11744 | ✗ | break; | |
| 11745 | |||
| 11746 | case ssiHAMMER: | ||
| 11747 | ✗ | temp_sub->d1 = itype_hammer; | |
| 11748 | ✗ | break; | |
| 11749 | |||
| 11750 | case ssiBOOTS: | ||
| 11751 | ✗ | temp_sub->d1 = itype_boots; | |
| 11752 | ✗ | break; | |
| 11753 | |||
| 11754 | case ssiDIVINEFIRE: | ||
| 11755 | ✗ | temp_sub->d1 = itype_divinefire; | |
| 11756 | ✗ | break; | |
| 11757 | |||
| 11758 | case ssiDIVINEESCAPE: | ||
| 11759 | ✗ | temp_sub->d1 = itype_divineescape; | |
| 11760 | ✗ | break; | |
| 11761 | |||
| 11762 | case ssiDIVINEPROTECTION: | ||
| 11763 | ✗ | temp_sub->d1 = itype_divineprotection; | |
| 11764 | ✗ | break; | |
| 11765 | |||
| 11766 | case ssiQUIVER: | ||
| 11767 | ✗ | temp_sub->d1 = itype_quiver; | |
| 11768 | ✗ | break; | |
| 11769 | |||
| 11770 | case ssiBOMBBAG: | ||
| 11771 | ✗ | temp_sub->d1 = itype_bombbag; | |
| 11772 | ✗ | break; | |
| 11773 | |||
| 11774 | case ssiCBYRNA: | ||
| 11775 | ✗ | temp_sub->d1 = itype_cbyrna; | |
| 11776 | ✗ | break; | |
| 11777 | |||
| 11778 | case ssiROCS: | ||
| 11779 | ✗ | temp_sub->d1 = itype_rocs; | |
| 11780 | ✗ | break; | |
| 11781 | |||
| 11782 | case ssiHOVERBOOTS: | ||
| 11783 | ✗ | temp_sub->d1 = itype_hoverboots; | |
| 11784 | ✗ | break; | |
| 11785 | |||
| 11786 | case ssiSPINSCROLL: | ||
| 11787 | ✗ | temp_sub->d1 = itype_spinscroll; | |
| 11788 | ✗ | break; | |
| 11789 | |||
| 11790 | case ssiCROSSSCROLL: | ||
| 11791 | ✗ | temp_sub->d1 = itype_crossscroll; | |
| 11792 | ✗ | break; | |
| 11793 | |||
| 11794 | case ssiQUAKESCROLL: | ||
| 11795 | ✗ | temp_sub->d1 = itype_quakescroll; | |
| 11796 | ✗ | break; | |
| 11797 | |||
| 11798 | case ssiWHISPRING: | ||
| 11799 | ✗ | temp_sub->d1 = itype_whispring; | |
| 11800 | ✗ | break; | |
| 11801 | |||
| 11802 | case ssiCHARGERING: | ||
| 11803 | ✗ | temp_sub->d1 = itype_chargering; | |
| 11804 | ✗ | break; | |
| 11805 | |||
| 11806 | case ssiPERILSCROLL: | ||
| 11807 | ✗ | temp_sub->d1 = itype_perilscroll; | |
| 11808 | ✗ | break; | |
| 11809 | |||
| 11810 | case ssiWEALTHMEDAL: | ||
| 11811 | ✗ | temp_sub->d1 = itype_wealthmedal; | |
| 11812 | ✗ | break; | |
| 11813 | |||
| 11814 | case ssiHEARTRING: | ||
| 11815 | ✗ | temp_sub->d1 = itype_heartring; | |
| 11816 | ✗ | break; | |
| 11817 | |||
| 11818 | case ssiMAGICRING: | ||
| 11819 | ✗ | temp_sub->d1 = itype_magicring; | |
| 11820 | ✗ | break; | |
| 11821 | |||
| 11822 | case ssiSPINSCROLL2: | ||
| 11823 | ✗ | temp_sub->d1 = itype_spinscroll2; | |
| 11824 | ✗ | break; | |
| 11825 | |||
| 11826 | case ssiQUAKESCROLL2: | ||
| 11827 | ✗ | temp_sub->d1 = itype_quakescroll2; | |
| 11828 | ✗ | break; | |
| 11829 | |||
| 11830 | case ssiAGONY: | ||
| 11831 | ✗ | temp_sub->d1 = itype_agony; | |
| 11832 | ✗ | break; | |
| 11833 | |||
| 11834 | case ssiSTOMPBOOTS: | ||
| 11835 | ✗ | temp_sub->d1 = itype_stompboots; | |
| 11836 | ✗ | break; | |
| 11837 | |||
| 11838 | case ssiWHIMSICALRING: | ||
| 11839 | ✗ | temp_sub->d1 = itype_whimsicalring; | |
| 11840 | ✗ | break; | |
| 11841 | |||
| 11842 | case ssiPERILRING: | ||
| 11843 | ✗ | temp_sub->d1 = itype_perilring; | |
| 11844 | ✗ | break; | |
| 11845 | |||
| 11846 | default: | ||
| 11847 | ✗ | temp_sub->d1 += itype_custom1 - ssiMAX; | |
| 11848 | ✗ | } | |
| 11849 | ✗ | } | |
| 11850 | |||
| 11851 | //fall-through | ||
| 11852 | default: | ||
| 11853 |
1/2✓ Branch 0 taken 39916 times.
✗ Branch 1 not taken.
|
39916 | if(!p_getc(&(temp_sub->dp1),f)) |
| 11854 | ✗ | return qe_invalid; | |
| 11855 | |||
| 11856 | 39916 | break; | |
| 11857 | } | ||
| 11858 | |||
| 11859 |
2/2✓ Branch 0 taken 8032 times.
✓ Branch 1 taken 35480 times.
|
43512 | if(s_version < 7) |
| 11860 | { | ||
| 11861 |
3/3✓ Branch 0 taken 29642 times.
✓ Branch 1 taken 1270 times.
✓ Branch 2 taken 4568 times.
|
35480 | switch(temp_sub->type) |
| 11862 | { | ||
| 11863 | case ssoMAGICGAUGE: | ||
| 11864 | { | ||
| 11865 |
2/2✓ Branch 0 taken 134 times.
✓ Branch 1 taken 1136 times.
|
1270 | if(!temp_sub->d9) |
| 11866 | 1136 | temp_sub->d9 = -1; //-1 now represents 'always' | |
| 11867 | 1270 | break; | |
| 11868 | } | ||
| 11869 | case ssoLIFEGAUGE: | ||
| 11870 | 4568 | temp_sub->d9 = 0; //Unused, doesn't do anything? Clear it... | |
| 11871 | 4568 | break; | |
| 11872 | } | ||
| 11873 | 35480 | } | |
| 11874 | |||
| 11875 |
3/3✓ Branch 0 taken 3354 times.
✓ Branch 1 taken 38710 times.
✓ Branch 2 taken 1448 times.
|
43512 | switch(temp_sub->type) |
| 11876 | { | ||
| 11877 | case ssoTEXT: | ||
| 11878 | case ssoTEXTBOX: | ||
| 11879 | case ssoCURRENTITEMTEXT: | ||
| 11880 | case ssoCURRENTITEMCLASSTEXT: | ||
| 11881 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 3354 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
3354 | if(g->objects[j].dp1 != NULL) delete[](char *)g->objects[j].dp1; |
| 11882 | |||
| 11883 | 3354 | memcpy(&g->objects[j],temp_sub,sizeof(subscreen_object)); | |
| 11884 | 3354 | g->objects[j].dp1 = new char[temp_size+2]; | |
| 11885 | 3354 | strcpy((char*)g->objects[j].dp1,tempdp1); | |
| 11886 | 3354 | break; | |
| 11887 | |||
| 11888 | case ssoCOUNTER: | ||
| 11889 |
1/2✓ Branch 0 taken 1448 times.
✗ Branch 1 not taken.
|
1448 | if(s_version<3) |
| 11890 | { | ||
| 11891 | ✗ | temp_sub->d6=(temp_sub->d6?1:0)+(temp_sub->d8?2:0); | |
| 11892 | ✗ | temp_sub->d8=0; | |
| 11893 | ✗ | } | |
| 11894 | |||
| 11895 | default: | ||
| 11896 | 40158 | memcpy(&g->objects[j],temp_sub,sizeof(subscreen_object)); | |
| 11897 | 40158 | break; | |
| 11898 | } | ||
| 11899 | |||
| 11900 | 43512 | g->name[0] = '\0'; | |
| 11901 | 43512 | strncat(g->name, tempname, 64 - 1); | |
| 11902 | 43512 | g->ss_type = temp_ss; | |
| 11903 | 43512 | } | |
| 11904 | |||
| 11905 |
2/2✓ Branch 0 taken 7034376 times.
✓ Branch 1 taken 27648 times.
|
7062024 | for(j=numsub; j<MAXSUBSCREENITEMS; j++) |
| 11906 | { | ||
| 11907 | //clear all unused object in this subscreen -DD | ||
| 11908 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 7034376 times.
|
7034376 | switch(g->objects[j].type) |
| 11909 | { | ||
| 11910 | case ssoTEXT: | ||
| 11911 | case ssoTEXTBOX: | ||
| 11912 | case ssoCURRENTITEMTEXT: | ||
| 11913 | case ssoCURRENTITEMCLASSTEXT: | ||
| 11914 | ✗ | if(g->objects[j].dp1 != NULL) delete [](char *)g->objects[j].dp1; | |
| 11915 | |||
| 11916 | //fall through | ||
| 11917 | default: | ||
| 11918 | 7034376 | memset(&g->objects[j],0,sizeof(subscreen_object)); | |
| 11919 | 7034376 | break; | |
| 11920 | } | ||
| 11921 | 7034376 | } | |
| 11922 | |||
| 11923 | 27648 | return 0; | |
| 11924 | 27648 | } | |
| 11925 | |||
| 11926 | 396 | int32_t readsubscreens(PACKFILE *f) | |
| 11927 | { | ||
| 11928 | word s_version; | ||
| 11929 | dword dummy; | ||
| 11930 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 396 times.
|
396 | if(!p_igetw(&s_version,f)) |
| 11931 | ✗ | return qe_invalid; | |
| 11932 | 396 | FFCore.quest_format[vSubscreen] = s_version; | |
| 11933 |
1/2✓ Branch 0 taken 396 times.
✗ Branch 1 not taken.
|
396 | if(!read_deprecated_section_cversion(f)) |
| 11934 | ✗ | return qe_invalid; | |
| 11935 |
1/2✓ Branch 0 taken 396 times.
✗ Branch 1 not taken.
|
396 | if(!p_igetl(&dummy,f)) //section size |
| 11936 | ✗ | return qe_invalid; | |
| 11937 | |||
| 11938 |
2/2✓ Branch 0 taken 216 times.
✓ Branch 1 taken 180 times.
|
396 | if(s_version < 8) |
| 11939 | 216 | return read_old_subscreens(f,s_version); | |
| 11940 | |||
| 11941 | 180 | subscreens_active.clear(); | |
| 11942 | 180 | subscreens_passive.clear(); | |
| 11943 | 180 | subscreens_overlay.clear(); | |
| 11944 | |||
| 11945 | byte sz; | ||
| 11946 |
1/2✓ Branch 0 taken 180 times.
✗ Branch 1 not taken.
|
180 | if(!p_getc(&sz,f)) |
| 11947 | ✗ | return qe_invalid; | |
| 11948 |
2/2✓ Branch 0 taken 591 times.
✓ Branch 1 taken 180 times.
|
771 | for(byte q = 0; q < sz; ++q) |
| 11949 | { | ||
| 11950 | 591 | ZCSubscreen& tmp = subscreens_active.emplace_back(); | |
| 11951 |
1/2✓ Branch 0 taken 591 times.
✗ Branch 1 not taken.
|
591 | if (auto ret = tmp.read(f, s_version)) |
| 11952 | ✗ | return ret; | |
| 11953 | 591 | } | |
| 11954 |
1/2✓ Branch 0 taken 180 times.
✗ Branch 1 not taken.
|
180 | if(!p_getc(&sz,f)) |
| 11955 | ✗ | return qe_invalid; | |
| 11956 |
2/2✓ Branch 0 taken 689 times.
✓ Branch 1 taken 180 times.
|
869 | for(byte q = 0; q < sz; ++q) |
| 11957 | { | ||
| 11958 | 689 | ZCSubscreen& tmp = subscreens_passive.emplace_back(); | |
| 11959 |
1/2✓ Branch 0 taken 689 times.
✗ Branch 1 not taken.
|
689 | if (auto ret = tmp.read(f, s_version)) |
| 11960 | ✗ | return ret; | |
| 11961 | 689 | } | |
| 11962 |
1/2✓ Branch 0 taken 180 times.
✗ Branch 1 not taken.
|
180 | if(!p_getc(&sz,f)) |
| 11963 | ✗ | return qe_invalid; | |
| 11964 |
2/2✓ Branch 0 taken 6 times.
✓ Branch 1 taken 180 times.
|
186 | for(byte q = 0; q < sz; ++q) |
| 11965 | { | ||
| 11966 | 6 | ZCSubscreen& tmp = subscreens_overlay.emplace_back(); | |
| 11967 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 6 times.
|
6 | if (auto ret = tmp.read(f, s_version)) |
| 11968 | ✗ | return ret; | |
| 11969 | 6 | } | |
| 11970 | 180 | return 0; | |
| 11971 | 396 | } | |
| 11972 | |||
| 11973 | ✗ | void reset_subscreen(subscreen_group *tempss) | |
| 11974 | { | ||
| 11975 | ✗ | for(int32_t i=0; i<MAXSUBSCREENITEMS; ++i) | |
| 11976 | { | ||
| 11977 | ✗ | switch(tempss->objects[i].type) | |
| 11978 | { | ||
| 11979 | case ssoTEXT: | ||
| 11980 | case ssoTEXTBOX: | ||
| 11981 | case ssoCURRENTITEMTEXT: | ||
| 11982 | case ssoCURRENTITEMCLASSTEXT: | ||
| 11983 | ✗ | if(tempss->objects[i].dp1 != NULL) delete [](char *)tempss->objects[i].dp1; | |
| 11984 | |||
| 11985 | //fall through | ||
| 11986 | default: | ||
| 11987 | ✗ | memset(&tempss->objects[i],0,sizeof(subscreen_object)); | |
| 11988 | ✗ | break; | |
| 11989 | } | ||
| 11990 | ✗ | } | |
| 11991 | ✗ | } | |
| 11992 | |||
| 11993 | 117 | void reset_subscreens() | |
| 11994 | { | ||
| 11995 | 117 | subscreens_active.clear(); | |
| 11996 | 117 | subscreens_passive.clear(); | |
| 11997 | 117 | subscreens_overlay.clear(); | |
| 11998 | 117 | } | |
| 11999 | |||
| 12000 | 117 | int32_t setupsubscreens() | |
| 12001 | { | ||
| 12002 | 117 | reset_subscreens(); | |
| 12003 | //return 0; | ||
| 12004 |
2/2✓ Branch 0 taken 117 times.
✓ Branch 1 taken 234 times.
|
351 | for(int q = 0; q < 2; ++q) |
| 12005 | { | ||
| 12006 | 234 | subscreens_active.emplace_back(); | |
| 12007 | 234 | subscreens_passive.emplace_back(); | |
| 12008 | 234 | } | |
| 12009 | 117 | int32_t tempsubscreen=subscr_mode; | |
| 12010 | |||
| 12011 |
1/2✓ Branch 0 taken 117 times.
✗ Branch 1 not taken.
|
117 | if(tempsubscreen>=ssdtMAX) |
| 12012 | ✗ | tempsubscreen=0; | |
| 12013 | |||
| 12014 |
1/3✗ Branch 0 not taken.
✓ Branch 1 taken 117 times.
✗ Branch 2 not taken.
|
117 | switch(tempsubscreen) |
| 12015 | { | ||
| 12016 | case ssdtOLD: | ||
| 12017 | case ssdtNEWSUBSCR: | ||
| 12018 | case ssdtREV2: | ||
| 12019 | case ssdtBSZELDA: | ||
| 12020 | case ssdtBSZELDAMODIFIED: | ||
| 12021 | case ssdtBSZELDAENHANCED: | ||
| 12022 | case ssdtBSZELDACOMPLETE: | ||
| 12023 | { | ||
| 12024 | 117 | subscreens_active[0].load_old(default_subscreen_active[tempsubscreen][0]); | |
| 12025 | 117 | subscreens_active[0].sub_type=sstACTIVE; | |
| 12026 | 117 | subscreens_active[0].name = "Active Subscreen (Triforce)"; | |
| 12027 | 117 | subscreens_active[1].load_old(default_subscreen_active[tempsubscreen][1]); | |
| 12028 | 117 | subscreens_active[1].sub_type=sstACTIVE; | |
| 12029 | 117 | subscreens_active[1].name = "Active Subscreen (Dungeon Map)"; | |
| 12030 | 117 | subscreens_passive[0].load_old(default_subscreen_passive[tempsubscreen][0]); | |
| 12031 | 117 | subscreens_passive[0].sub_type=sstPASSIVE; | |
| 12032 | 117 | subscreens_passive[0].name = "Passive Subscreen (Magic)"; | |
| 12033 | 117 | subscreens_passive[1].load_old(default_subscreen_passive[tempsubscreen][1]); | |
| 12034 | 117 | subscreens_passive[1].sub_type=sstPASSIVE; | |
| 12035 | 117 | subscreens_passive[1].name = "Passive Subscreen (No Magic)"; | |
| 12036 | 117 | break; | |
| 12037 | } | ||
| 12038 | |||
| 12039 | case ssdtZ3: | ||
| 12040 | { | ||
| 12041 | ✗ | subscreens_active[0].load_old(z3_active_a); | |
| 12042 | ✗ | subscreens_active[0].sub_type=sstACTIVE; | |
| 12043 | ✗ | subscreens_active[1].load_old(z3_active_ab); | |
| 12044 | ✗ | subscreens_active[1].sub_type=sstACTIVE; | |
| 12045 | ✗ | subscreens_passive[0].load_old(z3_passive_a); | |
| 12046 | ✗ | subscreens_passive[0].sub_type=sstPASSIVE; | |
| 12047 | ✗ | subscreens_passive[1].load_old(z3_passive_ab); | |
| 12048 | ✗ | subscreens_passive[1].sub_type=sstPASSIVE; | |
| 12049 | ✗ | break; | |
| 12050 | } | ||
| 12051 | } | ||
| 12052 | 117 | subscr_mode = ssdtMAX; | |
| 12053 | 117 | return 0; | |
| 12054 | } | ||
| 12055 | |||
| 12056 | extern std::vector<std::shared_ptr<zasm_script>> zasm_scripts; | ||
| 12057 | |||
| 12058 | extern script_data *ffscripts[NUMSCRIPTFFC]; | ||
| 12059 | extern script_data *itemscripts[NUMSCRIPTITEM]; | ||
| 12060 | extern script_data *guyscripts[NUMSCRIPTGUYS]; | ||
| 12061 | extern script_data *lwpnscripts[NUMSCRIPTWEAPONS]; | ||
| 12062 | extern script_data *ewpnscripts[NUMSCRIPTWEAPONS]; | ||
| 12063 | extern script_data *globalscripts[NUMSCRIPTGLOBAL]; | ||
| 12064 | extern script_data *genericscripts[NUMSCRIPTSGENERIC]; | ||
| 12065 | extern script_data *playerscripts[NUMSCRIPTHERO]; | ||
| 12066 | extern script_data *screenscripts[NUMSCRIPTSCREEN]; | ||
| 12067 | extern script_data *dmapscripts[NUMSCRIPTSDMAP]; | ||
| 12068 | extern script_data *itemspritescripts[NUMSCRIPTSITEMSPRITE]; | ||
| 12069 | extern script_data *comboscripts[NUMSCRIPTSCOMBODATA]; | ||
| 12070 | extern script_data *subscreenscripts[NUMSCRIPTSSUBSCREEN]; | ||
| 12071 | |||
| 12072 | static std::vector<const script_data*> read_scripts; | ||
| 12073 | |||
| 12074 | 424 | static script_data fake_script_data(ScriptType::None, 0); | |
| 12075 | |||
| 12076 | 510 | int32_t readffscript(PACKFILE *f, zquestheader *Header) | |
| 12077 | { | ||
| 12078 | int32_t dummy; | ||
| 12079 | 510 | word s_version=0, zmeta_version=0; | |
| 12080 | 510 | byte numscripts=0; | |
| 12081 | 510 | numscripts=numscripts; //to avoid unused variables warnings | |
| 12082 | int32_t ret; | ||
| 12083 | 510 | read_scripts.clear(); | |
| 12084 | 510 | zasm_scripts.clear(); | |
| 12085 | |||
| 12086 | //section version info | ||
| 12087 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 510 times.
|
510 | if(!p_igetw(&s_version,f)) |
| 12088 | { | ||
| 12089 | ✗ | return qe_invalid; | |
| 12090 | } | ||
| 12091 | |||
| 12092 | 510 | FFCore.quest_format[vFFScript] = s_version; | |
| 12093 | |||
| 12094 |
1/2✓ Branch 0 taken 510 times.
✗ Branch 1 not taken.
|
510 | if(!read_deprecated_section_cversion(f)) |
| 12095 | { | ||
| 12096 | ✗ | return qe_invalid; | |
| 12097 | } | ||
| 12098 | |||
| 12099 |
2/2✓ Branch 0 taken 314 times.
✓ Branch 1 taken 196 times.
|
510 | if(s_version >= 18) |
| 12100 | { | ||
| 12101 |
1/2✓ Branch 0 taken 196 times.
✗ Branch 1 not taken.
|
196 | if(!p_igetw(&zmeta_version,f)) |
| 12102 | { | ||
| 12103 | ✗ | return qe_invalid; | |
| 12104 | } | ||
| 12105 | 196 | } | |
| 12106 | |||
| 12107 | //section size | ||
| 12108 |
1/2✓ Branch 0 taken 510 times.
✗ Branch 1 not taken.
|
510 | if(!p_igetl(&dummy,f)) |
| 12109 | { | ||
| 12110 | ✗ | return qe_invalid; | |
| 12111 | } | ||
| 12112 | |||
| 12113 |
2/2✓ Branch 0 taken 291 times.
✓ Branch 1 taken 219 times.
|
510 | if ( FFCore.quest_format[vLastCompile] < 13 ) FFCore.quest_format[vLastCompile] = s_version; |
| 12114 | 510 | al_trace("Loaded scripts last compiled in ZScript version: %d\n", (FFCore.quest_format[vLastCompile])); | |
| 12115 | |||
| 12116 |
2/2✓ Branch 0 taken 315 times.
✓ Branch 1 taken 131 times.
|
510 | if(s_version >= 27) |
| 12117 | { | ||
| 12118 | 131 | ret = read_quest_zasm(f, s_version); | |
| 12119 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 131 times.
|
131 | if(ret) |
| 12120 | ✗ | return qe_invalid; | |
| 12121 | 131 | } | |
| 12122 | |||
| 12123 | //finally... section data | ||
| 12124 |
2/2✓ Branch 0 taken 202752 times.
✓ Branch 1 taken 446 times.
|
203198 | for(int32_t i = 0; i < ((s_version < 2) ? NUMSCRIPTFFCOLD : NUMSCRIPTFFC); i++) |
| 12125 | { | ||
| 12126 | 202752 | ret = read_one_ffscript(f, Header, i, s_version, ffscripts[i], zmeta_version); | |
| 12127 | |||
| 12128 |
1/2✓ Branch 0 taken 202752 times.
✗ Branch 1 not taken.
|
202752 | if (ret) |
| 12129 | { | ||
| 12130 | ✗ | return qe_invalid; | |
| 12131 | } | ||
| 12132 | 202752 | } | |
| 12133 | |||
| 12134 | /* HIGHLY UNORTHODOX UPDATING THING, by Deedee | ||
| 12135 | * This fixes changes to sprite jump values introduced in early 2.55 alphas. | ||
| 12136 | * Zoria didn't bump up the versions as liberally as he should have, but thankfully | ||
| 12137 | * there was a version bump a week before a change that broke stuff. | ||
| 12138 | */ | ||
| 12139 |
7/8✓ Branch 0 taken 196 times.
✓ Branch 1 taken 250 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 196 times.
✓ Branch 4 taken 196 times.
✓ Branch 5 taken 196 times.
✓ Branch 6 taken 196 times.
✓ Branch 7 taken 196 times.
|
446 | if(((Header->zelda_version < 0x253)||((Header->zelda_version == 0x253)&&(Header->build<33))||((Header->zelda_version > 0x253) && s_version < 12))) |
| 12140 | { | ||
| 12141 | 642 | set_qr(qr_SPRITE_JUMP_IS_TRUNCATED,1); | |
| 12142 | 642 | } | |
| 12143 |
2/2✓ Branch 0 taken 196 times.
✓ Branch 1 taken 200 times.
|
396 | if(s_version < 19) |
| 12144 | { | ||
| 12145 | 200 | set_qr(qr_FLUCTUATING_ENEMY_JUMP,1); | |
| 12146 | 200 | } | |
| 12147 | |||
| 12148 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 396 times.
|
396 | if(s_version > 1) |
| 12149 | { | ||
| 12150 |
2/2✓ Branch 0 taken 101376 times.
✓ Branch 1 taken 396 times.
|
101772 | for(int32_t i = 0; i < NUMSCRIPTITEM; i++) |
| 12151 | { | ||
| 12152 | 101376 | ret = read_one_ffscript(f, Header, i, s_version, itemscripts[i], zmeta_version); | |
| 12153 | |||
| 12154 |
1/2✓ Branch 0 taken 101376 times.
✗ Branch 1 not taken.
|
101376 | if (ret) |
| 12155 | { | ||
| 12156 | ✗ | return qe_invalid; | |
| 12157 | } | ||
| 12158 | 101376 | } | |
| 12159 | |||
| 12160 |
2/2✓ Branch 0 taken 101376 times.
✓ Branch 1 taken 396 times.
|
101772 | for(int32_t i = 0; i < NUMSCRIPTGUYS; i++) |
| 12161 | { | ||
| 12162 | 101376 | ret = read_one_ffscript(f, Header, i, s_version, guyscripts[i], zmeta_version); | |
| 12163 | |||
| 12164 |
1/2✓ Branch 0 taken 101376 times.
✗ Branch 1 not taken.
|
101376 | if (ret) |
| 12165 | { | ||
| 12166 | ✗ | return qe_invalid; | |
| 12167 | } | ||
| 12168 | 101376 | } | |
| 12169 | |||
| 12170 |
2/2✓ Branch 0 taken 101376 times.
✓ Branch 1 taken 396 times.
|
101772 | for(int32_t i = 0; i < NUMSCRIPTWEAPONS; i++) |
| 12171 | { | ||
| 12172 | 101376 | ret = read_one_ffscript(f, Header, i, s_version, &fake_script_data, zmeta_version); | |
| 12173 | |||
| 12174 |
1/2✓ Branch 0 taken 101376 times.
✗ Branch 1 not taken.
|
101376 | if (ret) |
| 12175 | { | ||
| 12176 | ✗ | return qe_invalid; | |
| 12177 | } | ||
| 12178 | 101376 | } | |
| 12179 | |||
| 12180 |
2/2✓ Branch 0 taken 101376 times.
✓ Branch 1 taken 396 times.
|
101772 | for(int32_t i = 0; i < NUMSCRIPTSCREEN; i++) |
| 12181 | { | ||
| 12182 | 101376 | ret = read_one_ffscript(f, Header, i, s_version, screenscripts[i], zmeta_version); | |
| 12183 | |||
| 12184 |
1/2✓ Branch 0 taken 101376 times.
✗ Branch 1 not taken.
|
101376 | if (ret) |
| 12185 | { | ||
| 12186 | ✗ | return qe_invalid; | |
| 12187 | } | ||
| 12188 | 101376 | } | |
| 12189 | |||
| 12190 |
2/2✓ Branch 0 taken 196 times.
✓ Branch 1 taken 200 times.
|
396 | if(s_version > 16) |
| 12191 | { | ||
| 12192 |
2/2✓ Branch 0 taken 1568 times.
✓ Branch 1 taken 196 times.
|
1764 | for(int32_t i = 0; i < NUMSCRIPTGLOBAL; ++i) |
| 12193 | { | ||
| 12194 | 1568 | ret = read_one_ffscript(f, Header, i, s_version, globalscripts[i], zmeta_version); | |
| 12195 | |||
| 12196 |
1/2✓ Branch 0 taken 1568 times.
✗ Branch 1 not taken.
|
1568 | if (ret) |
| 12197 | { | ||
| 12198 | ✗ | return qe_invalid; | |
| 12199 | } | ||
| 12200 | 1568 | } | |
| 12201 | 196 | } | |
| 12202 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 200 times.
|
200 | else if(s_version > 13) |
| 12203 | { | ||
| 12204 | ✗ | for(int32_t i = 0; i < NUMSCRIPTGLOBAL255OLD; ++i) | |
| 12205 | { | ||
| 12206 | ✗ | ret = read_one_ffscript(f, Header, i, s_version, globalscripts[i], zmeta_version); | |
| 12207 | |||
| 12208 | ✗ | if (ret) | |
| 12209 | { | ||
| 12210 | ✗ | return qe_invalid; | |
| 12211 | } | ||
| 12212 | ✗ | } | |
| 12213 | |||
| 12214 | ✗ | if(globalscripts[GLOBAL_SCRIPT_ONSAVE] != NULL) | |
| 12215 | ✗ | delete globalscripts[GLOBAL_SCRIPT_ONSAVE]; | |
| 12216 | |||
| 12217 | ✗ | globalscripts[GLOBAL_SCRIPT_ONSAVE] = new script_data(ScriptType::Global, GLOBAL_SCRIPT_ONSAVE); | |
| 12218 | ✗ | } | |
| 12219 |
1/2✓ Branch 0 taken 200 times.
✗ Branch 1 not taken.
|
200 | else if(s_version > 4) |
| 12220 | { | ||
| 12221 |
2/2✓ Branch 0 taken 800 times.
✓ Branch 1 taken 200 times.
|
1000 | for(int32_t i = 0; i < NUMSCRIPTGLOBAL253; ++i) |
| 12222 | { | ||
| 12223 | 800 | ret = read_one_ffscript(f, Header, i, s_version, globalscripts[i], zmeta_version); | |
| 12224 | |||
| 12225 |
1/2✓ Branch 0 taken 800 times.
✗ Branch 1 not taken.
|
800 | if (ret) |
| 12226 | { | ||
| 12227 | ✗ | return qe_invalid; | |
| 12228 | } | ||
| 12229 | 800 | } | |
| 12230 | |||
| 12231 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 200 times.
|
200 | if(globalscripts[GLOBAL_SCRIPT_ONLAUNCH] != NULL) |
| 12232 |
1/2✓ Branch 0 taken 200 times.
✗ Branch 1 not taken.
|
200 | delete globalscripts[GLOBAL_SCRIPT_ONLAUNCH]; |
| 12233 | |||
| 12234 |
1/2✓ Branch 0 taken 200 times.
✗ Branch 1 not taken.
|
200 | globalscripts[GLOBAL_SCRIPT_ONLAUNCH] = new script_data(ScriptType::Global, GLOBAL_SCRIPT_ONLAUNCH); |
| 12235 | |||
| 12236 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 200 times.
|
200 | if(globalscripts[GLOBAL_SCRIPT_ONCONTGAME] != NULL) |
| 12237 |
1/2✓ Branch 0 taken 200 times.
✗ Branch 1 not taken.
|
200 | delete globalscripts[GLOBAL_SCRIPT_ONCONTGAME]; |
| 12238 | |||
| 12239 |
1/2✓ Branch 0 taken 200 times.
✗ Branch 1 not taken.
|
200 | globalscripts[GLOBAL_SCRIPT_ONCONTGAME] = new script_data(ScriptType::Global, GLOBAL_SCRIPT_ONCONTGAME); |
| 12240 | |||
| 12241 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 200 times.
|
200 | if(globalscripts[GLOBAL_SCRIPT_F6] != NULL) |
| 12242 |
1/2✓ Branch 0 taken 200 times.
✗ Branch 1 not taken.
|
200 | delete globalscripts[GLOBAL_SCRIPT_F6]; |
| 12243 | |||
| 12244 |
1/2✓ Branch 0 taken 200 times.
✗ Branch 1 not taken.
|
200 | globalscripts[GLOBAL_SCRIPT_F6] = new script_data(ScriptType::Global, GLOBAL_SCRIPT_F6); |
| 12245 | |||
| 12246 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 200 times.
|
200 | if(globalscripts[GLOBAL_SCRIPT_ONSAVE] != NULL) |
| 12247 |
1/2✓ Branch 0 taken 200 times.
✗ Branch 1 not taken.
|
200 | delete globalscripts[GLOBAL_SCRIPT_ONSAVE]; |
| 12248 | |||
| 12249 |
1/2✓ Branch 0 taken 200 times.
✗ Branch 1 not taken.
|
200 | globalscripts[GLOBAL_SCRIPT_ONSAVE] = new script_data(ScriptType::Global, GLOBAL_SCRIPT_ONSAVE); |
| 12250 | 200 | } | |
| 12251 | else | ||
| 12252 | { | ||
| 12253 | ✗ | for(int32_t i = 0; i < NUMSCRIPTGLOBALOLD; i++) | |
| 12254 | { | ||
| 12255 | ✗ | ret = read_one_ffscript(f, Header, i, s_version, globalscripts[i], zmeta_version); | |
| 12256 | |||
| 12257 | ✗ | if (ret) | |
| 12258 | { | ||
| 12259 | ✗ | return qe_invalid; | |
| 12260 | } | ||
| 12261 | ✗ | } | |
| 12262 | |||
| 12263 | ✗ | if(globalscripts[GLOBAL_SCRIPT_ONSAVELOAD] != NULL) | |
| 12264 | ✗ | delete globalscripts[GLOBAL_SCRIPT_ONSAVELOAD]; | |
| 12265 | |||
| 12266 | ✗ | globalscripts[GLOBAL_SCRIPT_ONSAVELOAD] = new script_data(ScriptType::Global, GLOBAL_SCRIPT_ONSAVELOAD); | |
| 12267 | |||
| 12268 | ✗ | if(globalscripts[GLOBAL_SCRIPT_ONLAUNCH] != NULL) | |
| 12269 | ✗ | delete globalscripts[GLOBAL_SCRIPT_ONLAUNCH]; | |
| 12270 | |||
| 12271 | ✗ | globalscripts[GLOBAL_SCRIPT_ONLAUNCH] = new script_data(ScriptType::Global, GLOBAL_SCRIPT_ONLAUNCH); | |
| 12272 | |||
| 12273 | ✗ | if(globalscripts[GLOBAL_SCRIPT_ONCONTGAME] != NULL) | |
| 12274 | ✗ | delete globalscripts[GLOBAL_SCRIPT_ONCONTGAME]; | |
| 12275 | |||
| 12276 | ✗ | globalscripts[GLOBAL_SCRIPT_ONCONTGAME] = new script_data(ScriptType::Global, GLOBAL_SCRIPT_ONCONTGAME); | |
| 12277 | |||
| 12278 | ✗ | if(globalscripts[GLOBAL_SCRIPT_F6] != NULL) | |
| 12279 | ✗ | delete globalscripts[GLOBAL_SCRIPT_F6]; | |
| 12280 | |||
| 12281 | ✗ | globalscripts[GLOBAL_SCRIPT_F6] = new script_data(ScriptType::Global, GLOBAL_SCRIPT_F6); | |
| 12282 | |||
| 12283 | ✗ | if(globalscripts[GLOBAL_SCRIPT_ONSAVE] != NULL) | |
| 12284 | ✗ | delete globalscripts[GLOBAL_SCRIPT_ONSAVE]; | |
| 12285 | |||
| 12286 | ✗ | globalscripts[GLOBAL_SCRIPT_ONSAVE] = new script_data(ScriptType::Global, GLOBAL_SCRIPT_ONSAVE); | |
| 12287 | } | ||
| 12288 | |||
| 12289 |
2/2✓ Branch 0 taken 196 times.
✓ Branch 1 taken 200 times.
|
396 | if(s_version > 10) //expanded the number of Hero scripts to 5. |
| 12290 | { | ||
| 12291 |
2/2✓ Branch 0 taken 980 times.
✓ Branch 1 taken 196 times.
|
1176 | for(int32_t i = 0; i < NUMSCRIPTHERO; i++) |
| 12292 | { | ||
| 12293 | 980 | ret = read_one_ffscript(f, Header, i, s_version, playerscripts[i], zmeta_version); | |
| 12294 | |||
| 12295 |
1/2✓ Branch 0 taken 980 times.
✗ Branch 1 not taken.
|
980 | if (ret) |
| 12296 | { | ||
| 12297 | ✗ | return qe_invalid; | |
| 12298 | } | ||
| 12299 | 980 | } | |
| 12300 | 196 | } | |
| 12301 | else | ||
| 12302 | { | ||
| 12303 |
2/2✓ Branch 0 taken 600 times.
✓ Branch 1 taken 200 times.
|
800 | for(int32_t i = 0; i < NUMSCRIPTHEROOLD; i++) |
| 12304 | { | ||
| 12305 | 600 | ret = read_one_ffscript(f, Header, i, s_version, playerscripts[i], zmeta_version); | |
| 12306 | |||
| 12307 |
1/2✓ Branch 0 taken 600 times.
✗ Branch 1 not taken.
|
600 | if (ret) |
| 12308 | { | ||
| 12309 | ✗ | return qe_invalid; | |
| 12310 | } | ||
| 12311 | 600 | } | |
| 12312 |
1/2✓ Branch 0 taken 200 times.
✗ Branch 1 not taken.
|
200 | if(playerscripts[3] != NULL) |
| 12313 |
1/2✓ Branch 0 taken 200 times.
✗ Branch 1 not taken.
|
200 | delete playerscripts[3]; |
| 12314 | |||
| 12315 |
1/2✓ Branch 0 taken 200 times.
✗ Branch 1 not taken.
|
200 | playerscripts[3] = new script_data(ScriptType::Hero, 3); |
| 12316 | |||
| 12317 |
1/2✓ Branch 0 taken 200 times.
✗ Branch 1 not taken.
|
200 | if(playerscripts[4] != NULL) |
| 12318 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 200 times.
|
200 | delete playerscripts[4]; |
| 12319 | |||
| 12320 |
1/2✓ Branch 0 taken 200 times.
✗ Branch 1 not taken.
|
200 | playerscripts[4] = new script_data(ScriptType::Hero, 4); |
| 12321 | } | ||
| 12322 |
3/4✓ Branch 0 taken 196 times.
✓ Branch 1 taken 200 times.
✓ Branch 2 taken 196 times.
✗ Branch 3 not taken.
|
396 | if(s_version > 8 && s_version < 10) |
| 12323 | { | ||
| 12324 | |||
| 12325 | ✗ | for(int32_t i = 0; i < NUMSCRIPTWEAPONS; i++) | |
| 12326 | { | ||
| 12327 | ✗ | ret = read_one_ffscript(f, Header, i, s_version, ewpnscripts[i], zmeta_version); | |
| 12328 | |||
| 12329 | ✗ | if (ret) | |
| 12330 | { | ||
| 12331 | ✗ | return qe_invalid; | |
| 12332 | } | ||
| 12333 | ✗ | } | |
| 12334 | ✗ | for(int32_t i = 0; i < NUMSCRIPTSDMAP; i++) | |
| 12335 | { | ||
| 12336 | ✗ | ret = read_one_ffscript(f, Header, i, s_version, dmapscripts[i], zmeta_version); | |
| 12337 | |||
| 12338 | ✗ | if (ret) | |
| 12339 | { | ||
| 12340 | ✗ | return qe_invalid; | |
| 12341 | } | ||
| 12342 | ✗ | } | |
| 12343 | |||
| 12344 | ✗ | } | |
| 12345 |
2/2✓ Branch 0 taken 200 times.
✓ Branch 1 taken 196 times.
|
396 | if(s_version >= 10) |
| 12346 | { | ||
| 12347 |
2/2✓ Branch 0 taken 50176 times.
✓ Branch 1 taken 196 times.
|
50372 | for(int32_t i = 0; i < NUMSCRIPTWEAPONS; i++) |
| 12348 | { | ||
| 12349 | 50176 | ret = read_one_ffscript(f, Header, i, s_version, lwpnscripts[i], zmeta_version); | |
| 12350 | |||
| 12351 |
1/2✓ Branch 0 taken 50176 times.
✗ Branch 1 not taken.
|
50176 | if (ret) |
| 12352 | { | ||
| 12353 | ✗ | return qe_invalid; | |
| 12354 | } | ||
| 12355 | 50176 | } | |
| 12356 |
2/2✓ Branch 0 taken 50176 times.
✓ Branch 1 taken 196 times.
|
50372 | for(int32_t i = 0; i < NUMSCRIPTWEAPONS; i++) |
| 12357 | { | ||
| 12358 | 50176 | ret = read_one_ffscript(f, Header, i, s_version, ewpnscripts[i], zmeta_version); | |
| 12359 | |||
| 12360 |
1/2✓ Branch 0 taken 50176 times.
✗ Branch 1 not taken.
|
50176 | if (ret) |
| 12361 | { | ||
| 12362 | ✗ | return qe_invalid; | |
| 12363 | } | ||
| 12364 | 50176 | } | |
| 12365 |
2/2✓ Branch 0 taken 50176 times.
✓ Branch 1 taken 196 times.
|
50372 | for(int32_t i = 0; i < NUMSCRIPTSDMAP; i++) |
| 12366 | { | ||
| 12367 | 50176 | ret = read_one_ffscript(f, Header, i, s_version, dmapscripts[i], zmeta_version); | |
| 12368 | |||
| 12369 |
1/2✓ Branch 0 taken 50176 times.
✗ Branch 1 not taken.
|
50176 | if (ret) |
| 12370 | { | ||
| 12371 | ✗ | return qe_invalid; | |
| 12372 | } | ||
| 12373 | 50176 | } | |
| 12374 | |||
| 12375 | 196 | } | |
| 12376 |
2/2✓ Branch 0 taken 200 times.
✓ Branch 1 taken 196 times.
|
396 | if(s_version >=12) |
| 12377 | { | ||
| 12378 |
2/2✓ Branch 0 taken 50176 times.
✓ Branch 1 taken 196 times.
|
50372 | for(int32_t i = 0; i < NUMSCRIPTSITEMSPRITE; i++) |
| 12379 | { | ||
| 12380 | 50176 | ret = read_one_ffscript(f, Header, i, s_version, itemspritescripts[i], zmeta_version); | |
| 12381 | |||
| 12382 |
1/2✓ Branch 0 taken 50176 times.
✗ Branch 1 not taken.
|
50176 | if (ret) |
| 12383 | { | ||
| 12384 | ✗ | return qe_invalid; | |
| 12385 | } | ||
| 12386 | 50176 | } | |
| 12387 | 196 | } | |
| 12388 |
2/2✓ Branch 0 taken 200 times.
✓ Branch 1 taken 196 times.
|
396 | if(s_version >=15) |
| 12389 | { | ||
| 12390 |
2/2✓ Branch 0 taken 100352 times.
✓ Branch 1 taken 196 times.
|
100548 | for(int32_t i = 0; i < NUMSCRIPTSCOMBODATA; i++) |
| 12391 | { | ||
| 12392 | 100352 | ret = read_one_ffscript(f, Header, i, s_version, comboscripts[i], zmeta_version); | |
| 12393 | |||
| 12394 |
1/2✓ Branch 0 taken 100352 times.
✗ Branch 1 not taken.
|
100352 | if (ret) |
| 12395 | { | ||
| 12396 | ✗ | return qe_invalid; | |
| 12397 | } | ||
| 12398 | 100352 | } | |
| 12399 | 196 | } | |
| 12400 |
2/2✓ Branch 0 taken 200 times.
✓ Branch 1 taken 196 times.
|
396 | if(s_version >19) |
| 12401 | { | ||
| 12402 | 196 | word numgenscripts = NUMSCRIPTSGENERIC; | |
| 12403 |
1/2✓ Branch 0 taken 196 times.
✗ Branch 1 not taken.
|
196 | if(!p_igetw(&numgenscripts,f)) |
| 12404 | { | ||
| 12405 | ✗ | return qe_invalid; | |
| 12406 | } | ||
| 12407 |
2/2✓ Branch 0 taken 100352 times.
✓ Branch 1 taken 196 times.
|
100548 | for(int32_t i = 0; i < numgenscripts; i++) |
| 12408 | { | ||
| 12409 | 100352 | ret = read_one_ffscript(f, Header, i, s_version, genericscripts[i], zmeta_version); | |
| 12410 | |||
| 12411 |
1/2✓ Branch 0 taken 100352 times.
✗ Branch 1 not taken.
|
100352 | if (ret) |
| 12412 | { | ||
| 12413 | ✗ | return qe_invalid; | |
| 12414 | } | ||
| 12415 | 100352 | } | |
| 12416 | 196 | } | |
| 12417 |
2/2✓ Branch 0 taken 216 times.
✓ Branch 1 taken 180 times.
|
396 | if(s_version >21) |
| 12418 | { | ||
| 12419 | 180 | word numsubscripts = NUMSCRIPTSSUBSCREEN; | |
| 12420 |
1/2✓ Branch 0 taken 180 times.
✗ Branch 1 not taken.
|
180 | if(!p_igetw(&numsubscripts,f)) |
| 12421 | { | ||
| 12422 | ✗ | return qe_invalid; | |
| 12423 | } | ||
| 12424 |
2/2✓ Branch 0 taken 46080 times.
✓ Branch 1 taken 180 times.
|
46260 | for(int32_t i = 0; i < numsubscripts; i++) |
| 12425 | { | ||
| 12426 | 46080 | ret = read_one_ffscript(f, Header, i, s_version, subscreenscripts[i], zmeta_version); | |
| 12427 | |||
| 12428 |
1/2✓ Branch 0 taken 46080 times.
✗ Branch 1 not taken.
|
46080 | if (ret) |
| 12429 | { | ||
| 12430 | ✗ | return qe_invalid; | |
| 12431 | } | ||
| 12432 | 46080 | } | |
| 12433 | 180 | } | |
| 12434 | 396 | } | |
| 12435 | |||
| 12436 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 396 times.
|
396 | if(s_version > 2) |
| 12437 | { | ||
| 12438 | int32_t bufsize; | ||
| 12439 | 396 | p_igetl(&bufsize, f); | |
| 12440 |
2/4✓ Branch 0 taken 396 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 396 times.
|
396 | if (bufsize < 0 || bufsize > 1024*1024*10) |
| 12441 | { | ||
| 12442 | // God help anyone storing more than 10MB of code in the script buffer. | ||
| 12443 | ✗ | return qe_invalid; | |
| 12444 | } | ||
| 12445 | 396 | char * buf = new char[bufsize+1]; | |
| 12446 | 396 | pfread(buf, bufsize, f); | |
| 12447 | 396 | buf[bufsize]=0; | |
| 12448 | |||
| 12449 |
1/2✓ Branch 0 taken 396 times.
✗ Branch 1 not taken.
|
396 | zScript = string(buf); |
| 12450 | |||
| 12451 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 396 times.
|
396 | delete[] buf; |
| 12452 | word numffcbindings; | ||
| 12453 | 396 | p_igetw(&numffcbindings, f); | |
| 12454 | |||
| 12455 |
2/2✓ Branch 0 taken 10739 times.
✓ Branch 1 taken 396 times.
|
11135 | for(int32_t i=0; i<numffcbindings; i++) |
| 12456 | { | ||
| 12457 | word id; | ||
| 12458 | 10739 | p_igetw(&id, f); | |
| 12459 | 10739 | p_igetl(&bufsize, f); | |
| 12460 |
2/4✓ Branch 0 taken 10739 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 10739 times.
|
10739 | if (bufsize < 0 || bufsize > 1024) |
| 12461 | ✗ | return qe_invalid; | |
| 12462 | 10739 | buf = new char[bufsize+1]; | |
| 12463 | 10739 | pfread(buf, bufsize, f); | |
| 12464 | 10739 | buf[bufsize]=0; | |
| 12465 | |||
| 12466 | //fix for buggy older saved quests -DD | ||
| 12467 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 10739 times.
|
10739 | if(id < NUMSCRIPTFFC-1) |
| 12468 | 10739 | ffcmap[id].scriptname = buf; | |
| 12469 | |||
| 12470 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 10739 times.
|
10739 | delete[] buf; |
| 12471 | 10739 | } | |
| 12472 | |||
| 12473 | word numglobalbindings; | ||
| 12474 | 396 | p_igetw(&numglobalbindings, f); | |
| 12475 | |||
| 12476 |
2/2✓ Branch 0 taken 1574 times.
✓ Branch 1 taken 396 times.
|
1970 | for(int32_t i=0; i<numglobalbindings; i++) |
| 12477 | { | ||
| 12478 | word id; | ||
| 12479 | 1574 | p_igetw(&id, f); | |
| 12480 | 1574 | p_igetl(&bufsize, f); | |
| 12481 |
2/4✓ Branch 0 taken 1574 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1574 times.
✗ Branch 3 not taken.
|
1574 | if (bufsize < 0 || bufsize > 1024) |
| 12482 | ✗ | return qe_invalid; | |
| 12483 | 1574 | buf = new char[bufsize+1]; | |
| 12484 | 1574 | pfread(buf, bufsize, f); | |
| 12485 | 1574 | buf[bufsize]=0; | |
| 12486 | |||
| 12487 | // id in principle should be valid, since slot assignment cannot assign a global script to a bogus slot. | ||
| 12488 | // However, because of a corruption bug, some 2.50.x quests contain bogus entries in the global bindings table. | ||
| 12489 | // Ignore these. -DD | ||
| 12490 |
2/2✓ Branch 0 taken 546 times.
✓ Branch 1 taken 1028 times.
|
1574 | if (id < NUMSCRIPTGLOBAL) |
| 12491 | { | ||
| 12492 | //Disable old '~Continue's, they'd wreak havoc. Bit messy, apologies ~Joe | ||
| 12493 |
1/2✓ Branch 0 taken 1028 times.
✗ Branch 1 not taken.
|
1028 | if(strcmp(buf,"~Continue") == 0) |
| 12494 | { | ||
| 12495 | ✗ | globalmap[id].scriptname = ""; | |
| 12496 | |||
| 12497 | ✗ | if(globalscripts[GLOBAL_SCRIPT_ONSAVELOAD] != NULL) | |
| 12498 | ✗ | globalscripts[GLOBAL_SCRIPT_ONSAVELOAD]->disable(); | |
| 12499 | ✗ | } | |
| 12500 | else | ||
| 12501 | { | ||
| 12502 | 1028 | globalmap[id].scriptname = buf; | |
| 12503 | } | ||
| 12504 | 1028 | } | |
| 12505 | |||
| 12506 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1574 times.
|
1574 | delete[] buf; |
| 12507 | 1574 | } | |
| 12508 | |||
| 12509 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 396 times.
|
396 | if(s_version > 3) |
| 12510 | { | ||
| 12511 | word numitembindings; | ||
| 12512 | 396 | p_igetw(&numitembindings, f); | |
| 12513 | |||
| 12514 |
2/2✓ Branch 0 taken 1250 times.
✓ Branch 1 taken 396 times.
|
1646 | for(int32_t i=0; i<numitembindings; i++) |
| 12515 | { | ||
| 12516 | word id; | ||
| 12517 | 1250 | p_igetw(&id, f); | |
| 12518 | 1250 | p_igetl(&bufsize, f); | |
| 12519 |
2/4✓ Branch 0 taken 1250 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 1250 times.
|
1250 | if (bufsize < 0 || bufsize > 1024) |
| 12520 | ✗ | return qe_invalid; | |
| 12521 | 1250 | buf = new char[bufsize+1]; | |
| 12522 | 1250 | pfread(buf, bufsize, f); | |
| 12523 | 1250 | buf[bufsize]=0; | |
| 12524 | |||
| 12525 | //fix this too | ||
| 12526 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1250 times.
|
1250 | if(id <NUMSCRIPTITEM-1) |
| 12527 | 1250 | itemmap[id].scriptname = buf; | |
| 12528 | |||
| 12529 |
1/2✓ Branch 0 taken 1250 times.
✗ Branch 1 not taken.
|
1250 | delete[] buf; |
| 12530 | 1250 | } | |
| 12531 | 396 | } | |
| 12532 | //(v9+) | ||
| 12533 |
2/2✓ Branch 0 taken 200 times.
✓ Branch 1 taken 196 times.
|
396 | if(s_version > 8) |
| 12534 | { | ||
| 12535 | //npc scripts | ||
| 12536 | word numnpcbindings; | ||
| 12537 | 196 | p_igetw(&numnpcbindings, f); | |
| 12538 | |||
| 12539 |
2/2✓ Branch 0 taken 28 times.
✓ Branch 1 taken 196 times.
|
224 | for(int32_t i=0; i<numnpcbindings; i++) |
| 12540 | { | ||
| 12541 | word id; | ||
| 12542 | 28 | p_igetw(&id, f); | |
| 12543 | 28 | p_igetl(&bufsize, f); | |
| 12544 |
2/4✓ Branch 0 taken 28 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 28 times.
✗ Branch 3 not taken.
|
28 | if (bufsize < 0 || bufsize > 1024) |
| 12545 | ✗ | return qe_invalid; | |
| 12546 | 28 | buf = new char[bufsize+1]; | |
| 12547 | 28 | pfread(buf, bufsize, f); | |
| 12548 | 28 | buf[bufsize]=0; | |
| 12549 | |||
| 12550 | //fix this too | ||
| 12551 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 28 times.
|
28 | if(id <NUMSCRIPTGUYS-1) |
| 12552 | 28 | npcmap[id].scriptname = buf; | |
| 12553 | |||
| 12554 |
1/2✓ Branch 0 taken 28 times.
✗ Branch 1 not taken.
|
28 | delete[] buf; |
| 12555 | 28 | } | |
| 12556 | //lweapon | ||
| 12557 | word numlwpnbindings; | ||
| 12558 | 196 | p_igetw(&numlwpnbindings, f); | |
| 12559 | |||
| 12560 |
2/2✓ Branch 0 taken 305 times.
✓ Branch 1 taken 196 times.
|
501 | for(int32_t i=0; i<numlwpnbindings; i++) |
| 12561 | { | ||
| 12562 | word id; | ||
| 12563 | 305 | p_igetw(&id, f); | |
| 12564 | 305 | p_igetl(&bufsize, f); | |
| 12565 |
2/4✓ Branch 0 taken 305 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 305 times.
|
305 | if (bufsize < 0 || bufsize > 1024) |
| 12566 | ✗ | return qe_invalid; | |
| 12567 | 305 | buf = new char[bufsize+1]; | |
| 12568 | 305 | pfread(buf, bufsize, f); | |
| 12569 | 305 | buf[bufsize]=0; | |
| 12570 | |||
| 12571 | //fix this too | ||
| 12572 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 305 times.
|
305 | if(id <NUMSCRIPTWEAPONS-1) |
| 12573 | 305 | lwpnmap[id].scriptname = buf; | |
| 12574 | |||
| 12575 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 305 times.
|
305 | delete[] buf; |
| 12576 | 305 | } | |
| 12577 | //eweapon | ||
| 12578 | word numewpnbindings; | ||
| 12579 | 196 | p_igetw(&numewpnbindings, f); | |
| 12580 | |||
| 12581 |
2/2✓ Branch 0 taken 242 times.
✓ Branch 1 taken 196 times.
|
438 | for(int32_t i=0; i<numewpnbindings; i++) |
| 12582 | { | ||
| 12583 | word id; | ||
| 12584 | 242 | p_igetw(&id, f); | |
| 12585 | 242 | p_igetl(&bufsize, f); | |
| 12586 |
2/4✓ Branch 0 taken 242 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 242 times.
✗ Branch 3 not taken.
|
242 | if (bufsize < 0 || bufsize > 1024) |
| 12587 | ✗ | return qe_invalid; | |
| 12588 | 242 | buf = new char[bufsize+1]; | |
| 12589 | 242 | pfread(buf, bufsize, f); | |
| 12590 | 242 | buf[bufsize]=0; | |
| 12591 | |||
| 12592 | //fix this too | ||
| 12593 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 242 times.
|
242 | if(id <NUMSCRIPTWEAPONS-1) |
| 12594 | 242 | ewpnmap[id].scriptname = buf; | |
| 12595 | |||
| 12596 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 242 times.
|
242 | delete[] buf; |
| 12597 | 242 | } | |
| 12598 | //hero | ||
| 12599 | word numherobindings; | ||
| 12600 | 196 | p_igetw(&numherobindings, f); | |
| 12601 | |||
| 12602 |
2/2✓ Branch 0 taken 23 times.
✓ Branch 1 taken 196 times.
|
219 | for(int32_t i=0; i<numherobindings; i++) |
| 12603 | { | ||
| 12604 | word id; | ||
| 12605 | 23 | p_igetw(&id, f); | |
| 12606 | 23 | p_igetl(&bufsize, f); | |
| 12607 |
2/4✓ Branch 0 taken 23 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 23 times.
|
23 | if (bufsize < 0 || bufsize > 1024) |
| 12608 | ✗ | return qe_invalid; | |
| 12609 | 23 | buf = new char[bufsize+1]; | |
| 12610 | 23 | pfread(buf, bufsize, f); | |
| 12611 | 23 | buf[bufsize]=0; | |
| 12612 | |||
| 12613 | //fix this too | ||
| 12614 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 23 times.
|
23 | if(id <NUMSCRIPTHERO-1) |
| 12615 | 23 | playermap[id].scriptname = buf; | |
| 12616 | |||
| 12617 |
1/2✓ Branch 0 taken 23 times.
✗ Branch 1 not taken.
|
23 | delete[] buf; |
| 12618 | 23 | } | |
| 12619 | //dmaps | ||
| 12620 | word numdmapbindings; | ||
| 12621 | 196 | p_igetw(&numdmapbindings, f); | |
| 12622 | |||
| 12623 |
2/2✓ Branch 0 taken 447 times.
✓ Branch 1 taken 196 times.
|
643 | for(int32_t i=0; i<numdmapbindings; i++) |
| 12624 | { | ||
| 12625 | word id; | ||
| 12626 | 447 | p_igetw(&id, f); | |
| 12627 | 447 | p_igetl(&bufsize, f); | |
| 12628 |
2/4✓ Branch 0 taken 447 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 447 times.
|
447 | if (bufsize < 0 || bufsize > 1024) |
| 12629 | ✗ | return qe_invalid; | |
| 12630 | 447 | buf = new char[bufsize+1]; | |
| 12631 | 447 | pfread(buf, bufsize, f); | |
| 12632 | 447 | buf[bufsize]=0; | |
| 12633 | |||
| 12634 | //fix this too | ||
| 12635 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 447 times.
|
447 | if(id <NUMSCRIPTSDMAP-1) |
| 12636 | 447 | dmapmap[id].scriptname = buf; | |
| 12637 | |||
| 12638 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 447 times.
|
447 | delete[] buf; |
| 12639 | 447 | } | |
| 12640 | //screen | ||
| 12641 | word numscreenbindings; | ||
| 12642 | 196 | p_igetw(&numscreenbindings, f); | |
| 12643 | |||
| 12644 |
2/2✓ Branch 0 taken 418 times.
✓ Branch 1 taken 196 times.
|
614 | for(int32_t i=0; i<numscreenbindings; i++) |
| 12645 | { | ||
| 12646 | word id; | ||
| 12647 | 418 | p_igetw(&id, f); | |
| 12648 | 418 | p_igetl(&bufsize, f); | |
| 12649 |
2/4✓ Branch 0 taken 418 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 418 times.
✗ Branch 3 not taken.
|
418 | if (bufsize < 0 || bufsize > 1024) |
| 12650 | ✗ | return qe_invalid; | |
| 12651 | 418 | buf = new char[bufsize+1]; | |
| 12652 | 418 | pfread(buf, bufsize, f); | |
| 12653 | 418 | buf[bufsize]=0; | |
| 12654 | |||
| 12655 | //fix this too | ||
| 12656 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 418 times.
|
418 | if(id <NUMSCRIPTSDMAP-1) |
| 12657 | 418 | screenmap[id].scriptname = buf; | |
| 12658 | |||
| 12659 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 418 times.
|
418 | delete[] buf; |
| 12660 | 418 | } | |
| 12661 | 196 | } | |
| 12662 |
2/2✓ Branch 0 taken 200 times.
✓ Branch 1 taken 196 times.
|
396 | if(s_version > 11) |
| 12663 | { | ||
| 12664 | word numspritebindings; | ||
| 12665 | 196 | p_igetw(&numspritebindings, f); | |
| 12666 | |||
| 12667 |
2/2✓ Branch 0 taken 40 times.
✓ Branch 1 taken 196 times.
|
236 | for(int32_t i=0; i<numspritebindings; i++) |
| 12668 | { | ||
| 12669 | word id; | ||
| 12670 | 40 | p_igetw(&id, f); | |
| 12671 | 40 | p_igetl(&bufsize, f); | |
| 12672 |
2/4✓ Branch 0 taken 40 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 40 times.
|
40 | if (bufsize < 0 || bufsize > 1024) |
| 12673 | ✗ | return qe_invalid; | |
| 12674 | 40 | buf = new char[bufsize+1]; | |
| 12675 | 40 | pfread(buf, bufsize, f); | |
| 12676 | 40 | buf[bufsize]=0; | |
| 12677 | |||
| 12678 | //fix this too | ||
| 12679 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 40 times.
|
40 | if(id <NUMSCRIPTSDMAP-1) |
| 12680 | 40 | itemspritemap[id].scriptname = buf; | |
| 12681 | |||
| 12682 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 40 times.
|
40 | delete[] buf; |
| 12683 | 40 | } | |
| 12684 | 196 | } | |
| 12685 |
2/2✓ Branch 0 taken 200 times.
✓ Branch 1 taken 196 times.
|
396 | if(s_version >= 15) |
| 12686 | { | ||
| 12687 | word numcombobindings; | ||
| 12688 | 196 | p_igetw(&numcombobindings, f); | |
| 12689 | |||
| 12690 |
2/2✓ Branch 0 taken 134 times.
✓ Branch 1 taken 196 times.
|
330 | for(int32_t i=0; i<numcombobindings; i++) |
| 12691 | { | ||
| 12692 | word id; | ||
| 12693 | 134 | p_igetw(&id, f); | |
| 12694 | 134 | p_igetl(&bufsize, f); | |
| 12695 |
2/4✓ Branch 0 taken 134 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 134 times.
✗ Branch 3 not taken.
|
134 | if (bufsize < 0 || bufsize > 1024) |
| 12696 | ✗ | return qe_invalid; | |
| 12697 | 134 | buf = new char[bufsize+1]; | |
| 12698 | 134 | pfread(buf, bufsize, f); | |
| 12699 | 134 | buf[bufsize]=0; | |
| 12700 | |||
| 12701 | //fix this too | ||
| 12702 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 134 times.
|
134 | if(id <NUMSCRIPTSCOMBODATA-1) |
| 12703 | 134 | comboscriptmap[id].scriptname = buf; | |
| 12704 | |||
| 12705 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 134 times.
|
134 | delete[] buf; |
| 12706 | 134 | } | |
| 12707 | 196 | } | |
| 12708 |
2/2✓ Branch 0 taken 200 times.
✓ Branch 1 taken 196 times.
|
396 | if(s_version > 19) |
| 12709 | { | ||
| 12710 | word numgenericbindings; | ||
| 12711 | 196 | p_igetw(&numgenericbindings, f); | |
| 12712 | |||
| 12713 |
2/2✓ Branch 0 taken 2251 times.
✓ Branch 1 taken 196 times.
|
2447 | for(int32_t i=0; i<numgenericbindings; i++) |
| 12714 | { | ||
| 12715 | word id; | ||
| 12716 | 2251 | p_igetw(&id, f); | |
| 12717 | 2251 | p_igetl(&bufsize, f); | |
| 12718 |
2/4✓ Branch 0 taken 2251 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2251 times.
✗ Branch 3 not taken.
|
2251 | if (bufsize < 0 || bufsize > 1024) |
| 12719 | ✗ | return qe_invalid; | |
| 12720 | 2251 | buf = new char[bufsize+1]; | |
| 12721 | 2251 | pfread(buf, bufsize, f); | |
| 12722 | 2251 | buf[bufsize]=0; | |
| 12723 | |||
| 12724 | //fix this too | ||
| 12725 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2251 times.
|
2251 | if(id <NUMSCRIPTSGENERIC-1) |
| 12726 | 2251 | genericmap[id].scriptname = buf; | |
| 12727 | |||
| 12728 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2251 times.
|
2251 | delete[] buf; |
| 12729 | 2251 | } | |
| 12730 | 196 | } | |
| 12731 |
2/2✓ Branch 0 taken 216 times.
✓ Branch 1 taken 180 times.
|
396 | if(s_version > 21) |
| 12732 | { | ||
| 12733 | word numsubscreenbindings; | ||
| 12734 | 180 | p_igetw(&numsubscreenbindings, f); | |
| 12735 | |||
| 12736 |
2/2✓ Branch 0 taken 8 times.
✓ Branch 1 taken 180 times.
|
188 | for(int32_t i=0; i<numsubscreenbindings; i++) |
| 12737 | { | ||
| 12738 | word id; | ||
| 12739 | 8 | p_igetw(&id, f); | |
| 12740 | 8 | p_igetl(&bufsize, f); | |
| 12741 |
2/4✓ Branch 0 taken 8 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 8 times.
✗ Branch 3 not taken.
|
8 | if (bufsize < 0 || bufsize > 1024) |
| 12742 | ✗ | return qe_invalid; | |
| 12743 | 8 | buf = new char[bufsize+1]; | |
| 12744 | 8 | pfread(buf, bufsize, f); | |
| 12745 | 8 | buf[bufsize]=0; | |
| 12746 | |||
| 12747 | //fix this too | ||
| 12748 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 8 times.
|
8 | if(id <NUMSCRIPTSSUBSCREEN-1) |
| 12749 | 8 | subscreenmap[id].scriptname = buf; | |
| 12750 | |||
| 12751 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 8 times.
|
8 | delete[] buf; |
| 12752 | 8 | } | |
| 12753 | 180 | } | |
| 12754 | 396 | } | |
| 12755 | |||
| 12756 | // Set ZScriptVersion to the value encoded in the script's meta.ffscript_v. | ||
| 12757 | // This is only updated when the scripts have been recompiled. | ||
| 12758 | // They should all match each other. | ||
| 12759 | 396 | std::optional<word> zscript_version; | |
| 12760 |
2/2✓ Branch 0 taken 200 times.
✓ Branch 1 taken 196 times.
|
396 | if (s_version >= 16) |
| 12761 | { | ||
| 12762 |
2/2✓ Branch 0 taken 194 times.
✓ Branch 1 taken 7424 times.
|
7618 | for (auto script : read_scripts) |
| 12763 | { | ||
| 12764 |
2/2✓ Branch 0 taken 7422 times.
✓ Branch 1 taken 2 times.
|
7424 | if (script->meta.ffscript_v == 0) |
| 12765 | { | ||
| 12766 | // These scripts were saved in a version prior to this field being set. | ||
| 12767 | // See https://discord.com/channels/876899628556091432/1368485306394738718 | ||
| 12768 | 2 | zscript_version = 16; | |
| 12769 | 2 | break; | |
| 12770 | } | ||
| 12771 |
1/2✓ Branch 0 taken 7422 times.
✗ Branch 1 not taken.
|
7422 | if (script->meta.ffscript_v > s_version) |
| 12772 | ✗ | break; | |
| 12773 | |||
| 12774 |
2/2✓ Branch 0 taken 7246 times.
✓ Branch 1 taken 176 times.
|
7422 | if (!zscript_version.has_value()) |
| 12775 | { | ||
| 12776 | 176 | zscript_version = script->meta.ffscript_v; | |
| 12777 | 176 | continue; | |
| 12778 | } | ||
| 12779 | |||
| 12780 |
1/2✓ Branch 0 taken 7246 times.
✗ Branch 1 not taken.
|
7246 | if (zscript_version.value() != script->meta.ffscript_v) |
| 12781 | { | ||
| 12782 | ✗ | zscript_version.reset(); | |
| 12783 | ✗ | break; | |
| 12784 | } | ||
| 12785 | } | ||
| 12786 | |||
| 12787 |
2/2✓ Branch 0 taken 178 times.
✓ Branch 1 taken 18 times.
|
196 | if (!zscript_version.has_value()) |
| 12788 | 18 | al_trace("WARNING: Setting zscript version to section version as fallback.\n"); | |
| 12789 | 196 | } | |
| 12790 | 396 | setZScriptVersion(zscript_version.value_or(s_version)); | |
| 12791 | 396 | read_scripts.clear(); | |
| 12792 | |||
| 12793 | 396 | return 0; | |
| 12794 | 396 | } | |
| 12795 | |||
| 12796 | void(*reset_scripts_hook)(); | ||
| 12797 | |||
| 12798 | 478 | void reset_scripts() | |
| 12799 | { | ||
| 12800 | // We can't modify the script data while jit threads are possibly compiling them. | ||
| 12801 |
2/2✓ Branch 0 taken 11 times.
✓ Branch 1 taken 467 times.
|
478 | if (reset_scripts_hook) |
| 12802 | 467 | reset_scripts_hook(); | |
| 12803 | |||
| 12804 |
2/2✓ Branch 0 taken 244736 times.
✓ Branch 1 taken 478 times.
|
245214 | for(int32_t i=0; i<NUMSCRIPTSGENERIC; i++) |
| 12805 | { | ||
| 12806 |
1/2✓ Branch 0 taken 244736 times.
✗ Branch 1 not taken.
|
244736 | if (genericscripts[i]!=NULL) genericscripts[i]->disable(); |
| 12807 | ✗ | else genericscripts[i] = new script_data({ScriptType::Generic, i}); | |
| 12808 | 244736 | } | |
| 12809 | |||
| 12810 |
2/2✓ Branch 0 taken 244736 times.
✓ Branch 1 taken 478 times.
|
245214 | for(int32_t i=0; i<NUMSCRIPTFFC; i++) |
| 12811 | { | ||
| 12812 |
1/2✓ Branch 0 taken 244736 times.
✗ Branch 1 not taken.
|
244736 | if (ffscripts[i]) |
| 12813 | 244736 | ffscripts[i]->disable(); | |
| 12814 | else | ||
| 12815 | ✗ | ffscripts[i] = new script_data(ScriptType::FFC, i); | |
| 12816 | 244736 | } | |
| 12817 | |||
| 12818 |
2/2✓ Branch 0 taken 122368 times.
✓ Branch 1 taken 478 times.
|
122846 | for(int32_t i=0; i<NUMSCRIPTITEM; i++) |
| 12819 | { | ||
| 12820 |
1/2✓ Branch 0 taken 122368 times.
✗ Branch 1 not taken.
|
122368 | if (itemscripts[i]) |
| 12821 | 122368 | itemscripts[i]->disable(); | |
| 12822 | else | ||
| 12823 | ✗ | itemscripts[i] = new script_data(ScriptType::Item, i); | |
| 12824 | 122368 | } | |
| 12825 | |||
| 12826 |
2/2✓ Branch 0 taken 122368 times.
✓ Branch 1 taken 478 times.
|
122846 | for(int32_t i=0; i<NUMSCRIPTGUYS; i++) |
| 12827 | { | ||
| 12828 |
1/2✓ Branch 0 taken 122368 times.
✗ Branch 1 not taken.
|
122368 | if (guyscripts[i]) |
| 12829 | 122368 | guyscripts[i]->disable(); | |
| 12830 | else | ||
| 12831 | ✗ | guyscripts[i] = new script_data(ScriptType::NPC, i); | |
| 12832 | 122368 | } | |
| 12833 | |||
| 12834 |
2/2✓ Branch 0 taken 122368 times.
✓ Branch 1 taken 478 times.
|
122846 | for(int32_t i=0; i<NUMSCRIPTSCREEN; i++) |
| 12835 | { | ||
| 12836 |
1/2✓ Branch 0 taken 122368 times.
✗ Branch 1 not taken.
|
122368 | if (screenscripts[i]) |
| 12837 | 122368 | screenscripts[i]->disable(); | |
| 12838 | else | ||
| 12839 | ✗ | screenscripts[i] = new script_data(ScriptType::Screen, i); | |
| 12840 | 122368 | } | |
| 12841 | |||
| 12842 |
2/2✓ Branch 0 taken 3824 times.
✓ Branch 1 taken 478 times.
|
4302 | for(int32_t i=0; i<NUMSCRIPTGLOBAL; i++) |
| 12843 | { | ||
| 12844 |
1/2✓ Branch 0 taken 3824 times.
✗ Branch 1 not taken.
|
3824 | if (globalscripts[i]) |
| 12845 | 3824 | globalscripts[i]->disable(); | |
| 12846 | else | ||
| 12847 | ✗ | globalscripts[i] = new script_data(ScriptType::Global, i); | |
| 12848 | 3824 | } | |
| 12849 | |||
| 12850 |
2/2✓ Branch 0 taken 2390 times.
✓ Branch 1 taken 478 times.
|
2868 | for(int32_t i=0; i<NUMSCRIPTHERO; i++) |
| 12851 | { | ||
| 12852 |
1/2✓ Branch 0 taken 2390 times.
✗ Branch 1 not taken.
|
2390 | if (playerscripts[i]) |
| 12853 | 2390 | playerscripts[i]->disable(); | |
| 12854 | else | ||
| 12855 | ✗ | playerscripts[i] = new script_data(ScriptType::Hero, i); | |
| 12856 | 2390 | } | |
| 12857 | |||
| 12858 |
2/2✓ Branch 0 taken 122368 times.
✓ Branch 1 taken 478 times.
|
122846 | for(int32_t i=0; i<NUMSCRIPTWEAPONS; i++) |
| 12859 | { | ||
| 12860 |
1/2✓ Branch 0 taken 122368 times.
✗ Branch 1 not taken.
|
122368 | if (lwpnscripts[i]) |
| 12861 | 122368 | lwpnscripts[i]->disable(); | |
| 12862 | else | ||
| 12863 | ✗ | lwpnscripts[i] = new script_data(ScriptType::Lwpn, i); | |
| 12864 | 122368 | } | |
| 12865 |
2/2✓ Branch 0 taken 122368 times.
✓ Branch 1 taken 478 times.
|
122846 | for(int32_t i=0; i<NUMSCRIPTWEAPONS; i++) |
| 12866 | { | ||
| 12867 |
1/2✓ Branch 0 taken 122368 times.
✗ Branch 1 not taken.
|
122368 | if (ewpnscripts[i]) |
| 12868 | 122368 | ewpnscripts[i]->disable(); | |
| 12869 | else | ||
| 12870 | ✗ | ewpnscripts[i] = new script_data(ScriptType::Ewpn, i); | |
| 12871 | 122368 | } | |
| 12872 | |||
| 12873 |
2/2✓ Branch 0 taken 122368 times.
✓ Branch 1 taken 478 times.
|
122846 | for(int32_t i=0; i<NUMSCRIPTSDMAP; i++) |
| 12874 | { | ||
| 12875 |
1/2✓ Branch 0 taken 122368 times.
✗ Branch 1 not taken.
|
122368 | if (dmapscripts[i]) |
| 12876 | 122368 | dmapscripts[i]->disable(); | |
| 12877 | else | ||
| 12878 | ✗ | dmapscripts[i] = new script_data(ScriptType::DMap, i); | |
| 12879 | 122368 | } | |
| 12880 |
2/2✓ Branch 0 taken 122368 times.
✓ Branch 1 taken 478 times.
|
122846 | for(int32_t i=0; i<NUMSCRIPTSITEMSPRITE; i++) |
| 12881 | { | ||
| 12882 |
1/2✓ Branch 0 taken 122368 times.
✗ Branch 1 not taken.
|
122368 | if (itemspritescripts[i]) |
| 12883 | 122368 | itemspritescripts[i]->disable(); | |
| 12884 | else | ||
| 12885 | ✗ | itemspritescripts[i] = new script_data(ScriptType::ItemSprite, i); | |
| 12886 | 122368 | } | |
| 12887 |
2/2✓ Branch 0 taken 244736 times.
✓ Branch 1 taken 478 times.
|
245214 | for(int32_t i=0; i<NUMSCRIPTSCOMBODATA; i++) |
| 12888 | { | ||
| 12889 |
1/2✓ Branch 0 taken 244736 times.
✗ Branch 1 not taken.
|
244736 | if (comboscripts[i]) |
| 12890 | 244736 | comboscripts[i]->disable(); | |
| 12891 | else | ||
| 12892 | ✗ | comboscripts[i] = new script_data(ScriptType::Combo, i); | |
| 12893 | 244736 | } | |
| 12894 |
2/2✓ Branch 0 taken 478 times.
✓ Branch 1 taken 122368 times.
|
122846 | for(int32_t i=0; i<NUMSCRIPTSSUBSCREEN; i++) |
| 12895 | { | ||
| 12896 |
1/2✓ Branch 0 taken 122368 times.
✗ Branch 1 not taken.
|
122368 | if (subscreenscripts[i]) |
| 12897 | 122368 | subscreenscripts[i]->disable(); | |
| 12898 | else | ||
| 12899 | ✗ | subscreenscripts[i] = new script_data(ScriptType::EngineSubscreen, i); | |
| 12900 | 122368 | } | |
| 12901 | 478 | } | |
| 12902 | |||
| 12903 | // 3.0+ calls this. | ||
| 12904 | 131 | int32_t read_quest_zasm(PACKFILE *f, word s_version) | |
| 12905 | { | ||
| 12906 | int32_t num_commands; | ||
| 12907 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 131 times.
|
131 | if(!p_igetl(&num_commands,f)) |
| 12908 | ✗ | return qe_invalid; | |
| 12909 | #ifdef ZC_FUZZ | ||
| 12910 | const int32_t command_limit = 300000; | ||
| 12911 | #else | ||
| 12912 | 131 | const int32_t command_limit = 25000000; | |
| 12913 | #endif | ||
| 12914 |
2/4✓ Branch 0 taken 131 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 131 times.
|
131 | if (num_commands < 0 || num_commands > command_limit) |
| 12915 | ✗ | return qe_invalid; | |
| 12916 | |||
| 12917 | 131 | std::vector<ffscript> zasm; | |
| 12918 |
1/2✓ Branch 0 taken 131 times.
✗ Branch 1 not taken.
|
131 | zasm.reserve(num_commands); |
| 12919 |
2/2✓ Branch 0 taken 3422426 times.
✓ Branch 1 taken 131 times.
|
3422557 | for(int32_t j=0; j<num_commands; j++) |
| 12920 | { | ||
| 12921 |
1/2✓ Branch 0 taken 3422426 times.
✗ Branch 1 not taken.
|
3422426 | ffscript temp_script; |
| 12922 |
2/4✓ Branch 0 taken 3422426 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 3422426 times.
✗ Branch 3 not taken.
|
3422426 | if(!p_igetw(&(temp_script.command),f)) |
| 12923 | ✗ | return qe_invalid; | |
| 12924 | |||
| 12925 |
2/4✓ Branch 0 taken 3422426 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 3422426 times.
✗ Branch 3 not taken.
|
3422426 | if(!p_igetl(&(temp_script.arg1),f)) |
| 12926 | ✗ | return qe_invalid; | |
| 12927 | |||
| 12928 |
2/4✓ Branch 0 taken 3422426 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 3422426 times.
✗ Branch 3 not taken.
|
3422426 | if(!p_igetl(&(temp_script.arg2),f)) |
| 12929 | ✗ | return qe_invalid; | |
| 12930 | |||
| 12931 |
2/4✓ Branch 0 taken 3422426 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 3422426 times.
✗ Branch 3 not taken.
|
3422426 | if(!p_igetl(&(temp_script.arg3),f)) |
| 12932 | ✗ | return qe_invalid; | |
| 12933 | |||
| 12934 | 3422426 | uint32_t sz = 0; | |
| 12935 |
2/4✓ Branch 0 taken 3422426 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 3422426 times.
✗ Branch 3 not taken.
|
3422426 | if(!p_igetl(&sz,f)) |
| 12936 | ✗ | return qe_invalid; | |
| 12937 |
2/2✓ Branch 0 taken 41581 times.
✓ Branch 1 taken 3380845 times.
|
3422426 | if(sz) //string found |
| 12938 | { | ||
| 12939 |
1/2✓ Branch 0 taken 41581 times.
✗ Branch 1 not taken.
|
41581 | temp_script.strptr = new std::string(); |
| 12940 | char dummy; | ||
| 12941 |
2/2✓ Branch 0 taken 757107 times.
✓ Branch 1 taken 41581 times.
|
798688 | for(size_t q = 0; q < sz; ++q) |
| 12942 | { | ||
| 12943 |
2/4✓ Branch 0 taken 757107 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 757107 times.
✗ Branch 3 not taken.
|
757107 | if(!p_getc(&dummy,f)) |
| 12944 | ✗ | return qe_invalid; | |
| 12945 |
1/2✓ Branch 0 taken 757107 times.
✗ Branch 1 not taken.
|
757107 | temp_script.strptr->push_back(dummy); |
| 12946 | 757107 | } | |
| 12947 | 41581 | } | |
| 12948 |
2/4✓ Branch 0 taken 3422426 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 3422426 times.
✗ Branch 3 not taken.
|
3422426 | if(!p_igetl(&sz,f)) |
| 12949 | ✗ | return qe_invalid; | |
| 12950 |
2/2✓ Branch 0 taken 6533 times.
✓ Branch 1 taken 3415893 times.
|
3422426 | if(sz) //vector found |
| 12951 | { | ||
| 12952 |
1/2✓ Branch 0 taken 6533 times.
✗ Branch 1 not taken.
|
6533 | temp_script.vecptr = new std::vector<int32_t>(); |
| 12953 | int32_t dummy; | ||
| 12954 |
2/2✓ Branch 0 taken 18588 times.
✓ Branch 1 taken 6533 times.
|
25121 | for(size_t q = 0; q < sz; ++q) |
| 12955 | { | ||
| 12956 |
2/4✓ Branch 0 taken 18588 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 18588 times.
✗ Branch 3 not taken.
|
18588 | if(!p_igetl(&dummy,f)) |
| 12957 | ✗ | return qe_invalid; | |
| 12958 |
1/2✓ Branch 0 taken 18588 times.
✗ Branch 1 not taken.
|
18588 | temp_script.vecptr->push_back(dummy); |
| 12959 | 18588 | } | |
| 12960 | 6533 | } | |
| 12961 |
1/2✓ Branch 0 taken 3422426 times.
✗ Branch 1 not taken.
|
3422426 | zasm.emplace_back(std::move(temp_script)); |
| 12962 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 3422426 times.
|
3422426 | } |
| 12963 | |||
| 12964 |
1/2✓ Branch 0 taken 131 times.
✗ Branch 1 not taken.
|
131 | assert(zasm_scripts.empty()); |
| 12965 | 131 | zasm_script_id id = zasm_scripts.size(); | |
| 12966 |
2/4✓ Branch 0 taken 131 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 131 times.
|
131 | zasm_scripts.emplace_back(std::make_shared<zasm_script>(id, "@single", std::move(zasm))); |
| 12967 | |||
| 12968 | 131 | return 0; | |
| 12969 | 131 | } | |
| 12970 | |||
| 12971 | 1059692 | int32_t read_one_ffscript(PACKFILE *f, zquestheader *, int32_t script_index, word s_version, script_data *script, word zmeta_version) | |
| 12972 | { | ||
| 12973 | ASSERT(script); | ||
| 12974 |
2/2✓ Branch 0 taken 554949 times.
✓ Branch 1 taken 504743 times.
|
1059692 | if(s_version < 27) |
| 12975 | 554949 | return read_old_ffscript(f, script_index, s_version, script, zmeta_version); | |
| 12976 | |||
| 12977 | char exists; | ||
| 12978 |
1/2✓ Branch 0 taken 504743 times.
✗ Branch 1 not taken.
|
504743 | if (!p_getc(&exists, f)) |
| 12979 | ✗ | return qe_invalid; | |
| 12980 |
2/2✓ Branch 0 taken 4693 times.
✓ Branch 1 taken 500050 times.
|
504743 | if (!exists) |
| 12981 | { | ||
| 12982 | 500050 | script->disable(); | |
| 12983 | 500050 | return 0; | |
| 12984 | } | ||
| 12985 | |||
| 12986 | //Read meta | ||
| 12987 | { | ||
| 12988 | 4693 | zasm_meta temp_meta; | |
| 12989 | |||
| 12990 |
2/4✓ Branch 0 taken 4693 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4693 times.
✗ Branch 3 not taken.
|
4693 | if(!p_igetw(&(temp_meta.zasm_v),f)) |
| 12991 | ✗ | return qe_invalid; | |
| 12992 |
2/4✓ Branch 0 taken 4693 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4693 times.
✗ Branch 3 not taken.
|
4693 | if(!p_igetw(&(temp_meta.meta_v),f)) |
| 12993 | ✗ | return qe_invalid; | |
| 12994 |
2/4✓ Branch 0 taken 4693 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4693 times.
✗ Branch 3 not taken.
|
4693 | if(!p_igetw(&(temp_meta.ffscript_v),f)) |
| 12995 | ✗ | return qe_invalid; | |
| 12996 |
2/4✓ Branch 0 taken 4693 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4693 times.
✗ Branch 3 not taken.
|
4693 | if(!p_getc(&(temp_meta.script_type),f)) |
| 12997 | ✗ | return qe_invalid; | |
| 12998 | |||
| 12999 |
2/2✓ Branch 0 taken 37544 times.
✓ Branch 1 taken 4693 times.
|
42237 | for(int32_t q = 0; q < 8; ++q) |
| 13000 | { | ||
| 13001 |
2/4✓ Branch 0 taken 37544 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 37544 times.
✗ Branch 3 not taken.
|
37544 | if(!p_getcstr(&temp_meta.run_idens[q],f)) |
| 13002 | ✗ | return qe_invalid; | |
| 13003 | 37544 | } | |
| 13004 | |||
| 13005 |
2/2✓ Branch 0 taken 4693 times.
✓ Branch 1 taken 37544 times.
|
42237 | for(int32_t q = 0; q < 8; ++q) |
| 13006 |
2/4✓ Branch 0 taken 37544 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 37544 times.
✗ Branch 3 not taken.
|
37544 | if(!p_getc(&(temp_meta.run_types[q]),f)) |
| 13007 | ✗ | return qe_invalid; | |
| 13008 | |||
| 13009 |
2/4✓ Branch 0 taken 4693 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4693 times.
✗ Branch 3 not taken.
|
4693 | if(!p_getc(&(temp_meta.flags),f)) |
| 13010 | ✗ | return qe_invalid; | |
| 13011 | |||
| 13012 |
2/4✓ Branch 0 taken 4693 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4693 times.
✗ Branch 3 not taken.
|
4693 | if(!p_igetw(&(temp_meta.compiler_v1),f)) |
| 13013 | ✗ | return qe_invalid; | |
| 13014 |
2/4✓ Branch 0 taken 4693 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4693 times.
✗ Branch 3 not taken.
|
4693 | if(!p_igetw(&(temp_meta.compiler_v2),f)) |
| 13015 | ✗ | return qe_invalid; | |
| 13016 |
2/4✓ Branch 0 taken 4693 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4693 times.
✗ Branch 3 not taken.
|
4693 | if(!p_igetw(&(temp_meta.compiler_v3),f)) |
| 13017 | ✗ | return qe_invalid; | |
| 13018 |
2/4✓ Branch 0 taken 4693 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4693 times.
✗ Branch 3 not taken.
|
4693 | if(!p_igetw(&(temp_meta.compiler_v4),f)) |
| 13019 | ✗ | return qe_invalid; | |
| 13020 | |||
| 13021 |
2/4✓ Branch 0 taken 4693 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4693 times.
✗ Branch 3 not taken.
|
4693 | if(!p_getcstr(&temp_meta.script_name,f)) |
| 13022 | ✗ | return qe_invalid; | |
| 13023 |
2/4✓ Branch 0 taken 4693 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4693 times.
✗ Branch 3 not taken.
|
4693 | if(!p_getcstr(&temp_meta.author,f)) |
| 13024 | ✗ | return qe_invalid; | |
| 13025 | 4693 | auto num_meta_attrib = 10; | |
| 13026 |
2/2✓ Branch 0 taken 46930 times.
✓ Branch 1 taken 4693 times.
|
51623 | for(auto q = 0; q < num_meta_attrib; ++q) |
| 13027 | { | ||
| 13028 |
2/4✓ Branch 0 taken 46930 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 46930 times.
✗ Branch 3 not taken.
|
46930 | if(!p_getcstr(&temp_meta.attributes[q],f)) |
| 13029 | ✗ | return qe_invalid; | |
| 13030 |
2/4✓ Branch 0 taken 46930 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 46930 times.
✗ Branch 3 not taken.
|
46930 | if(!p_getwstr(&temp_meta.attributes_help[q],f)) |
| 13031 | ✗ | return qe_invalid; | |
| 13032 | 46930 | } | |
| 13033 |
2/2✓ Branch 0 taken 37544 times.
✓ Branch 1 taken 4693 times.
|
42237 | for(auto q = 0; q < 8; ++q) |
| 13034 | { | ||
| 13035 |
2/4✓ Branch 0 taken 37544 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 37544 times.
✗ Branch 3 not taken.
|
37544 | if(!p_getcstr(&temp_meta.attribytes[q],f)) |
| 13036 | ✗ | return qe_invalid; | |
| 13037 |
2/4✓ Branch 0 taken 37544 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 37544 times.
✗ Branch 3 not taken.
|
37544 | if(!p_getwstr(&temp_meta.attribytes_help[q],f)) |
| 13038 | ✗ | return qe_invalid; | |
| 13039 | 37544 | } | |
| 13040 |
2/2✓ Branch 0 taken 37544 times.
✓ Branch 1 taken 4693 times.
|
42237 | for(auto q = 0; q < 8; ++q) |
| 13041 | { | ||
| 13042 |
2/4✓ Branch 0 taken 37544 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 37544 times.
✗ Branch 3 not taken.
|
37544 | if(!p_getcstr(&temp_meta.attrishorts[q],f)) |
| 13043 | ✗ | return qe_invalid; | |
| 13044 |
2/4✓ Branch 0 taken 37544 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 37544 times.
✗ Branch 3 not taken.
|
37544 | if(!p_getwstr(&temp_meta.attrishorts_help[q],f)) |
| 13045 | ✗ | return qe_invalid; | |
| 13046 | 37544 | } | |
| 13047 |
2/2✓ Branch 0 taken 75088 times.
✓ Branch 1 taken 4693 times.
|
79781 | for(auto q = 0; q < 16; ++q) |
| 13048 | { | ||
| 13049 |
2/4✓ Branch 0 taken 75088 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 75088 times.
✗ Branch 3 not taken.
|
75088 | if(!p_getcstr(&temp_meta.usrflags[q],f)) |
| 13050 | ✗ | return qe_invalid; | |
| 13051 |
2/4✓ Branch 0 taken 75088 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 75088 times.
✗ Branch 3 not taken.
|
75088 | if(!p_getwstr(&temp_meta.usrflags_help[q],f)) |
| 13052 | ✗ | return qe_invalid; | |
| 13053 | 75088 | } | |
| 13054 |
2/2✓ Branch 0 taken 37544 times.
✓ Branch 1 taken 4693 times.
|
42237 | for(auto q = 0; q < 8; ++q) |
| 13055 | { | ||
| 13056 |
2/4✓ Branch 0 taken 37544 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 37544 times.
✗ Branch 3 not taken.
|
37544 | if(!p_getcstr(&temp_meta.initd[q],f)) |
| 13057 | ✗ | return qe_invalid; | |
| 13058 |
2/4✓ Branch 0 taken 37544 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 37544 times.
✗ Branch 3 not taken.
|
37544 | if(!p_getwstr(&temp_meta.initd_help[q],f)) |
| 13059 | ✗ | return qe_invalid; | |
| 13060 | 37544 | } | |
| 13061 |
2/2✓ Branch 0 taken 4693 times.
✓ Branch 1 taken 37544 times.
|
42237 | for(auto q = 0; q < 8; ++q) |
| 13062 | { | ||
| 13063 |
2/4✓ Branch 0 taken 37544 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 37544 times.
✗ Branch 3 not taken.
|
37544 | if(!p_getc(&temp_meta.initd_type[q],f)) |
| 13064 | ✗ | return qe_invalid; | |
| 13065 | 37544 | } | |
| 13066 | |||
| 13067 |
1/2✓ Branch 0 taken 4693 times.
✗ Branch 1 not taken.
|
4693 | script->meta = temp_meta; |
| 13068 |
1/3✗ Branch 0 not taken.
✗ Branch 1 not taken.
✓ Branch 2 taken 4693 times.
|
4693 | } |
| 13069 |
1/2✓ Branch 0 taken 4693 times.
✗ Branch 1 not taken.
|
4693 | if(!p_igetl(&script->pc, f)) |
| 13070 | ✗ | return qe_invalid; | |
| 13071 |
1/2✓ Branch 0 taken 4693 times.
✗ Branch 1 not taken.
|
4693 | if(!p_igetl(&script->end_pc, f)) |
| 13072 | ✗ | return qe_invalid; | |
| 13073 | |||
| 13074 |
1/2✓ Branch 0 taken 4693 times.
✗ Branch 1 not taken.
|
4693 | if (script == &fake_script_data) |
| 13075 | ✗ | return 0; | |
| 13076 | |||
| 13077 |
1/2✓ Branch 0 taken 4693 times.
✗ Branch 1 not taken.
|
4693 | assert(zasm_scripts.size() == 1); |
| 13078 | 4693 | auto& zs = zasm_scripts[0]; | |
| 13079 | 4693 | script->zasm_script = zs; | |
| 13080 | |||
| 13081 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4693 times.
|
4693 | if (script->valid()) |
| 13082 | { | ||
| 13083 | 4693 | zs->script_datas.push_back(script); | |
| 13084 | 4693 | read_scripts.push_back(script); | |
| 13085 | 4693 | } | |
| 13086 | |||
| 13087 | 4693 | return 0; | |
| 13088 | 1059692 | } | |
| 13089 | |||
| 13090 | 554949 | int32_t read_old_ffscript(PACKFILE *f, int32_t script_index, word s_version, script_data *script, word zmeta_version) | |
| 13091 | { | ||
| 13092 | 554949 | char b33[34] = {0}; | |
| 13093 | 554949 | b33[33] = 0; | |
| 13094 | 554949 | int32_t num_commands=1000; | |
| 13095 | |||
| 13096 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 554949 times.
|
554949 | if(s_version>=2) |
| 13097 | { | ||
| 13098 |
1/2✓ Branch 0 taken 554949 times.
✗ Branch 1 not taken.
|
554949 | if(!p_igetl(&num_commands,f)) |
| 13099 | { | ||
| 13100 | ✗ | return qe_invalid; | |
| 13101 | } | ||
| 13102 | 554949 | } | |
| 13103 | |||
| 13104 | #ifdef ZC_FUZZ | ||
| 13105 | const int32_t command_limit = 300000; | ||
| 13106 | #else | ||
| 13107 | 554949 | const int32_t command_limit = 10000000; | |
| 13108 | #endif | ||
| 13109 |
2/4✓ Branch 0 taken 554949 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 554949 times.
|
554949 | if (num_commands < 0 || num_commands > command_limit) |
| 13110 | { | ||
| 13111 | ✗ | return qe_invalid; | |
| 13112 | } | ||
| 13113 | |||
| 13114 | 554949 | std::vector<ffscript> zasm; | |
| 13115 |
1/2✓ Branch 0 taken 554949 times.
✗ Branch 1 not taken.
|
554949 | zasm.reserve(num_commands); |
| 13116 | |||
| 13117 |
2/2✓ Branch 0 taken 246349 times.
✓ Branch 1 taken 308600 times.
|
554949 | if(s_version >= 16) |
| 13118 | { | ||
| 13119 |
1/2✓ Branch 0 taken 246349 times.
✗ Branch 1 not taken.
|
246349 | zasm_meta temp_meta; |
| 13120 | |||
| 13121 |
2/4✓ Branch 0 taken 246349 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 246349 times.
✗ Branch 3 not taken.
|
246349 | if(!p_igetw(&(temp_meta.zasm_v),f)) |
| 13122 | { | ||
| 13123 | ✗ | return qe_invalid; | |
| 13124 | } | ||
| 13125 | |||
| 13126 |
2/4✓ Branch 0 taken 246349 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 246349 times.
✗ Branch 3 not taken.
|
246349 | if(!p_igetw(&(temp_meta.meta_v),f)) |
| 13127 | { | ||
| 13128 | ✗ | return qe_invalid; | |
| 13129 | } | ||
| 13130 | |||
| 13131 |
2/4✓ Branch 0 taken 246349 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 246349 times.
✗ Branch 3 not taken.
|
246349 | if(!p_igetw(&(temp_meta.ffscript_v),f)) |
| 13132 | { | ||
| 13133 | ✗ | return qe_invalid; | |
| 13134 | } | ||
| 13135 | |||
| 13136 |
2/4✓ Branch 0 taken 246349 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 246349 times.
✗ Branch 3 not taken.
|
246349 | if(!p_getc(&(temp_meta.script_type),f)) |
| 13137 | { | ||
| 13138 | ✗ | return qe_invalid; | |
| 13139 | } | ||
| 13140 | |||
| 13141 |
2/2✓ Branch 0 taken 1970792 times.
✓ Branch 1 taken 246349 times.
|
2217141 | for(int32_t q = 0; q < 8; ++q) |
| 13142 | { | ||
| 13143 |
2/2✓ Branch 0 taken 115104 times.
✓ Branch 1 taken 1855688 times.
|
1970792 | if(zmeta_version < 3) |
| 13144 | { | ||
| 13145 |
2/2✓ Branch 0 taken 115104 times.
✓ Branch 1 taken 3798432 times.
|
3913536 | for(int32_t c = 0; c < 33; ++c) |
| 13146 | { | ||
| 13147 |
2/4✓ Branch 0 taken 3798432 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 3798432 times.
✗ Branch 3 not taken.
|
3798432 | if(!p_getc(&(b33[c]),f)) |
| 13148 | { | ||
| 13149 | ✗ | return qe_invalid; | |
| 13150 | } | ||
| 13151 | 3798432 | } | |
| 13152 |
1/2✓ Branch 0 taken 115104 times.
✗ Branch 1 not taken.
|
115104 | temp_meta.run_idens[q].assign(b33); |
| 13153 | 115104 | } | |
| 13154 | else | ||
| 13155 | { | ||
| 13156 |
2/4✓ Branch 0 taken 1855688 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1855688 times.
✗ Branch 3 not taken.
|
1855688 | if(!p_getcstr(&temp_meta.run_idens[q],f)) |
| 13157 | { | ||
| 13158 | ✗ | return qe_invalid; | |
| 13159 | } | ||
| 13160 | } | ||
| 13161 | 1970792 | } | |
| 13162 | |||
| 13163 |
2/2✓ Branch 0 taken 246349 times.
✓ Branch 1 taken 1970792 times.
|
2217141 | for(int32_t q = 0; q < 8; ++q) |
| 13164 | { | ||
| 13165 |
2/4✓ Branch 0 taken 1970792 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1970792 times.
✗ Branch 3 not taken.
|
1970792 | if(!p_getc(&(temp_meta.run_types[q]),f)) |
| 13166 | { | ||
| 13167 | ✗ | return qe_invalid; | |
| 13168 | } | ||
| 13169 | 1970792 | } | |
| 13170 | |||
| 13171 |
2/4✓ Branch 0 taken 246349 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 246349 times.
✗ Branch 3 not taken.
|
246349 | if(!p_getc(&(temp_meta.flags),f)) |
| 13172 | { | ||
| 13173 | ✗ | return qe_invalid; | |
| 13174 | } | ||
| 13175 | |||
| 13176 |
2/4✓ Branch 0 taken 246349 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 246349 times.
✗ Branch 3 not taken.
|
246349 | if(!p_igetw(&(temp_meta.compiler_v1),f)) |
| 13177 | { | ||
| 13178 | ✗ | return qe_invalid; | |
| 13179 | } | ||
| 13180 | |||
| 13181 |
2/4✓ Branch 0 taken 246349 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 246349 times.
✗ Branch 3 not taken.
|
246349 | if(!p_igetw(&(temp_meta.compiler_v2),f)) |
| 13182 | { | ||
| 13183 | ✗ | return qe_invalid; | |
| 13184 | } | ||
| 13185 | |||
| 13186 |
2/4✓ Branch 0 taken 246349 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 246349 times.
✗ Branch 3 not taken.
|
246349 | if(!p_igetw(&(temp_meta.compiler_v3),f)) |
| 13187 | { | ||
| 13188 | ✗ | return qe_invalid; | |
| 13189 | } | ||
| 13190 | |||
| 13191 |
2/4✓ Branch 0 taken 246349 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 246349 times.
✗ Branch 3 not taken.
|
246349 | if(!p_igetw(&(temp_meta.compiler_v4),f)) |
| 13192 | { | ||
| 13193 | ✗ | return qe_invalid; | |
| 13194 | } | ||
| 13195 | |||
| 13196 |
2/2✓ Branch 0 taken 14388 times.
✓ Branch 1 taken 231961 times.
|
246349 | if(zmeta_version == 2) |
| 13197 | { | ||
| 13198 |
2/2✓ Branch 0 taken 14388 times.
✓ Branch 1 taken 474804 times.
|
489192 | for(int32_t c = 0; c < 33; ++c) |
| 13199 | { | ||
| 13200 |
2/4✓ Branch 0 taken 474804 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 474804 times.
✗ Branch 3 not taken.
|
474804 | if(!p_getc(&b33[c],f)) |
| 13201 | { | ||
| 13202 | ✗ | return qe_invalid; | |
| 13203 | } | ||
| 13204 | 474804 | } | |
| 13205 |
1/2✓ Branch 0 taken 14388 times.
✗ Branch 1 not taken.
|
14388 | temp_meta.script_name.assign(b33); |
| 13206 | |||
| 13207 |
2/2✓ Branch 0 taken 14388 times.
✓ Branch 1 taken 474804 times.
|
489192 | for(int32_t c = 0; c < 33; ++c) |
| 13208 | { | ||
| 13209 |
2/4✓ Branch 0 taken 474804 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 474804 times.
✗ Branch 3 not taken.
|
474804 | if(!p_getc(&b33[c],f)) |
| 13210 | { | ||
| 13211 | ✗ | return qe_invalid; | |
| 13212 | } | ||
| 13213 | 474804 | } | |
| 13214 |
1/2✓ Branch 0 taken 14388 times.
✗ Branch 1 not taken.
|
14388 | temp_meta.author.assign(b33); |
| 13215 | 14388 | } | |
| 13216 |
1/2✓ Branch 0 taken 231961 times.
✗ Branch 1 not taken.
|
231961 | else if(zmeta_version > 2) |
| 13217 | { | ||
| 13218 |
2/4✓ Branch 0 taken 231961 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 231961 times.
✗ Branch 3 not taken.
|
231961 | if(!p_getcstr(&temp_meta.script_name,f)) |
| 13219 | ✗ | return qe_invalid; | |
| 13220 |
2/4✓ Branch 0 taken 231961 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 231961 times.
✗ Branch 3 not taken.
|
231961 | if(!p_getcstr(&temp_meta.author,f)) |
| 13221 | ✗ | return qe_invalid; | |
| 13222 | 231961 | auto num_meta_attrib = (zmeta_version < 5 ? 4 : 10); | |
| 13223 |
2/2✓ Branch 0 taken 2319610 times.
✓ Branch 1 taken 231961 times.
|
2551571 | for(auto q = 0; q < num_meta_attrib; ++q) |
| 13224 | { | ||
| 13225 |
2/4✓ Branch 0 taken 2319610 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2319610 times.
✗ Branch 3 not taken.
|
2319610 | if(!p_getcstr(&temp_meta.attributes[q],f)) |
| 13226 | ✗ | return qe_invalid; | |
| 13227 |
2/4✓ Branch 0 taken 2319610 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2319610 times.
✗ Branch 3 not taken.
|
2319610 | if(!p_getwstr(&temp_meta.attributes_help[q],f)) |
| 13228 | ✗ | return qe_invalid; | |
| 13229 | 2319610 | } | |
| 13230 |
2/2✓ Branch 0 taken 1855688 times.
✓ Branch 1 taken 231961 times.
|
2087649 | for(auto q = 0; q < 8; ++q) |
| 13231 | { | ||
| 13232 |
2/4✓ Branch 0 taken 1855688 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1855688 times.
✗ Branch 3 not taken.
|
1855688 | if(!p_getcstr(&temp_meta.attribytes[q],f)) |
| 13233 | ✗ | return qe_invalid; | |
| 13234 |
2/4✓ Branch 0 taken 1855688 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1855688 times.
✗ Branch 3 not taken.
|
1855688 | if(!p_getwstr(&temp_meta.attribytes_help[q],f)) |
| 13235 | ✗ | return qe_invalid; | |
| 13236 | 1855688 | } | |
| 13237 |
2/2✓ Branch 0 taken 1855688 times.
✓ Branch 1 taken 231961 times.
|
2087649 | for(auto q = 0; q < 8; ++q) |
| 13238 | { | ||
| 13239 |
2/4✓ Branch 0 taken 1855688 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1855688 times.
✗ Branch 3 not taken.
|
1855688 | if(!p_getcstr(&temp_meta.attrishorts[q],f)) |
| 13240 | ✗ | return qe_invalid; | |
| 13241 |
2/4✓ Branch 0 taken 1855688 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1855688 times.
✗ Branch 3 not taken.
|
1855688 | if(!p_getwstr(&temp_meta.attrishorts_help[q],f)) |
| 13242 | ✗ | return qe_invalid; | |
| 13243 | 1855688 | } | |
| 13244 |
2/2✓ Branch 0 taken 3711376 times.
✓ Branch 1 taken 231961 times.
|
3943337 | for(auto q = 0; q < 16; ++q) |
| 13245 | { | ||
| 13246 |
2/4✓ Branch 0 taken 3711376 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 3711376 times.
✗ Branch 3 not taken.
|
3711376 | if(!p_getcstr(&temp_meta.usrflags[q],f)) |
| 13247 | ✗ | return qe_invalid; | |
| 13248 |
2/4✓ Branch 0 taken 3711376 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 3711376 times.
✗ Branch 3 not taken.
|
3711376 | if(!p_getwstr(&temp_meta.usrflags_help[q],f)) |
| 13249 | ✗ | return qe_invalid; | |
| 13250 | 3711376 | } | |
| 13251 | 231961 | } | |
| 13252 |
2/2✓ Branch 0 taken 231961 times.
✓ Branch 1 taken 14388 times.
|
246349 | if(zmeta_version > 3) |
| 13253 | { | ||
| 13254 |
2/2✓ Branch 0 taken 1855688 times.
✓ Branch 1 taken 231961 times.
|
2087649 | for(auto q = 0; q < 8; ++q) |
| 13255 | { | ||
| 13256 |
2/4✓ Branch 0 taken 1855688 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1855688 times.
✗ Branch 3 not taken.
|
1855688 | if(!p_getcstr(&temp_meta.initd[q],f)) |
| 13257 | ✗ | return qe_invalid; | |
| 13258 |
2/4✓ Branch 0 taken 1855688 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1855688 times.
✗ Branch 3 not taken.
|
1855688 | if(!p_getwstr(&temp_meta.initd_help[q],f)) |
| 13259 | ✗ | return qe_invalid; | |
| 13260 | 1855688 | } | |
| 13261 |
2/2✓ Branch 0 taken 1855688 times.
✓ Branch 1 taken 231961 times.
|
2087649 | for(auto q = 0; q < 8; ++q) |
| 13262 | { | ||
| 13263 |
2/4✓ Branch 0 taken 1855688 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1855688 times.
✗ Branch 3 not taken.
|
1855688 | if(!p_getc(&temp_meta.initd_type[q],f)) |
| 13264 | ✗ | return qe_invalid; | |
| 13265 | 1855688 | } | |
| 13266 | 231961 | } | |
| 13267 | else | ||
| 13268 | { | ||
| 13269 |
2/2✓ Branch 0 taken 115104 times.
✓ Branch 1 taken 14388 times.
|
129492 | for(auto q = 0; q < 8; ++q) |
| 13270 | { | ||
| 13271 |
1/2✓ Branch 0 taken 115104 times.
✗ Branch 1 not taken.
|
115104 | temp_meta.initd[q] = temp_meta.run_idens[q]; |
| 13272 | 115104 | } | |
| 13273 | } | ||
| 13274 | |||
| 13275 |
1/2✓ Branch 0 taken 246349 times.
✗ Branch 1 not taken.
|
246349 | script->meta = temp_meta; |
| 13276 |
3/6✗ Branch 0 not taken.
✓ Branch 1 taken 246349 times.
✓ Branch 2 taken 308600 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 308600 times.
✗ Branch 5 not taken.
|
554949 | } else script->meta = {}; |
| 13277 | |||
| 13278 |
2/2✓ Branch 0 taken 74674 times.
✓ Branch 1 taken 103208884 times.
|
103283558 | for(int32_t j=0; j<num_commands; j++) |
| 13279 | { | ||
| 13280 |
1/2✓ Branch 0 taken 103208884 times.
✗ Branch 1 not taken.
|
103208884 | auto& sc = zasm.emplace_back(); |
| 13281 |
2/4✓ Branch 0 taken 103208884 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 103208884 times.
✗ Branch 3 not taken.
|
103208884 | if(!p_igetw(&sc.command,f)) |
| 13282 | { | ||
| 13283 | ✗ | return qe_invalid; | |
| 13284 | } | ||
| 13285 | |||
| 13286 |
2/2✓ Branch 0 taken 102728609 times.
✓ Branch 1 taken 480275 times.
|
103208884 | if(sc.command == 0xFFFF) |
| 13287 | 480275 | break; | |
| 13288 | else | ||
| 13289 | { | ||
| 13290 |
2/4✓ Branch 0 taken 102728609 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 102728609 times.
✗ Branch 3 not taken.
|
102728609 | if(!p_igetl(&sc.arg1,f)) |
| 13291 | { | ||
| 13292 | ✗ | return qe_invalid; | |
| 13293 | } | ||
| 13294 | |||
| 13295 |
2/4✓ Branch 0 taken 102728609 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 102728609 times.
✗ Branch 3 not taken.
|
102728609 | if(!p_igetl(&sc.arg2,f)) |
| 13296 | { | ||
| 13297 | ✗ | return qe_invalid; | |
| 13298 | } | ||
| 13299 | |||
| 13300 |
2/2✓ Branch 0 taken 1047747 times.
✓ Branch 1 taken 101680862 times.
|
102728609 | if(s_version >= 24) |
| 13301 |
2/4✓ Branch 0 taken 1047747 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1047747 times.
✗ Branch 3 not taken.
|
1047747 | if(!p_igetl(&sc.arg3,f)) |
| 13302 | ✗ | return qe_invalid; | |
| 13303 | |||
| 13304 |
2/2✓ Branch 0 taken 8222037 times.
✓ Branch 1 taken 94506572 times.
|
102728609 | if(s_version >= 21) |
| 13305 | { | ||
| 13306 | 8222037 | uint32_t sz = 0; | |
| 13307 |
2/4✓ Branch 0 taken 8222037 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 8222037 times.
✗ Branch 3 not taken.
|
8222037 | if(!p_igetl(&sz,f)) |
| 13308 | { | ||
| 13309 | ✗ | return qe_invalid; | |
| 13310 | } | ||
| 13311 |
2/2✓ Branch 0 taken 19400 times.
✓ Branch 1 taken 8202637 times.
|
8222037 | if(sz) //string found |
| 13312 | { | ||
| 13313 |
1/2✓ Branch 0 taken 19400 times.
✗ Branch 1 not taken.
|
19400 | sc.strptr = new std::string(); |
| 13314 | char dummy; | ||
| 13315 |
2/2✓ Branch 0 taken 1165008 times.
✓ Branch 1 taken 19400 times.
|
1184408 | for(size_t q = 0; q < sz; ++q) |
| 13316 | { | ||
| 13317 |
2/4✓ Branch 0 taken 1165008 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1165008 times.
✗ Branch 3 not taken.
|
1165008 | if(!p_getc(&dummy,f)) |
| 13318 | { | ||
| 13319 | ✗ | return qe_invalid; | |
| 13320 | } | ||
| 13321 |
1/2✓ Branch 0 taken 1165008 times.
✗ Branch 1 not taken.
|
1165008 | sc.strptr->push_back(dummy); |
| 13322 | 1165008 | } | |
| 13323 | 19400 | } | |
| 13324 |
2/4✓ Branch 0 taken 8222037 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 8222037 times.
✗ Branch 3 not taken.
|
8222037 | if(!p_igetl(&sz,f)) |
| 13325 | { | ||
| 13326 | ✗ | return qe_invalid; | |
| 13327 | } | ||
| 13328 |
2/2✓ Branch 0 taken 933 times.
✓ Branch 1 taken 8221104 times.
|
8222037 | if(sz) //vector found |
| 13329 | { | ||
| 13330 |
1/2✓ Branch 0 taken 933 times.
✗ Branch 1 not taken.
|
933 | sc.vecptr = new std::vector<int32_t>(); |
| 13331 | int32_t dummy; | ||
| 13332 |
2/2✓ Branch 0 taken 11526 times.
✓ Branch 1 taken 933 times.
|
12459 | for(size_t q = 0; q < sz; ++q) |
| 13333 | { | ||
| 13334 |
2/4✓ Branch 0 taken 11526 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 11526 times.
✗ Branch 3 not taken.
|
11526 | if(!p_igetl(&dummy,f)) |
| 13335 | { | ||
| 13336 | ✗ | return qe_invalid; | |
| 13337 | } | ||
| 13338 |
1/2✓ Branch 0 taken 11526 times.
✗ Branch 1 not taken.
|
11526 | sc.vecptr->push_back(dummy); |
| 13339 | 11526 | } | |
| 13340 | 933 | } | |
| 13341 | 8222037 | } | |
| 13342 | } | ||
| 13343 | 102728609 | } | |
| 13344 | |||
| 13345 |
2/2✓ Branch 0 taken 487109 times.
✓ Branch 1 taken 67840 times.
|
554949 | if (script == &fake_script_data) |
| 13346 | 67840 | return 0; | |
| 13347 | |||
| 13348 | // If the first command is unknown, invalidate the whole thing. | ||
| 13349 | // Saw this for https://www.purezc.net/index.php?page=quests&id=411 hero script 0 | ||
| 13350 |
5/6✓ Branch 0 taken 417811 times.
✓ Branch 1 taken 69298 times.
✓ Branch 2 taken 406147 times.
✓ Branch 3 taken 11664 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 406147 times.
|
487109 | if (!zasm.empty() && zasm[0].command >= NUMCOMMANDS && zasm[0].command != 0xFFFF) |
| 13351 | { | ||
| 13352 | ✗ | al_trace("Warning: found script with bad instruction, disabling script: %s %d\n", ScriptTypeToString(script->id.type), script->id.index); | |
| 13353 | ✗ | zasm.clear(); | |
| 13354 | ✗ | } | |
| 13355 | |||
| 13356 | 487109 | zasm_script_id id = zasm_scripts.size(); | |
| 13357 |
3/6✓ Branch 0 taken 487109 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 487109 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 487109 times.
✗ Branch 5 not taken.
|
487109 | auto& zs = zasm_scripts.emplace_back(std::make_shared<zasm_script>(id, script->name(), std::move(zasm))); |
| 13358 | 487109 | script->zasm_script = zs; | |
| 13359 | 487109 | script->pc = 0; | |
| 13360 | 487109 | script->end_pc = zs->size; | |
| 13361 |
3/4✓ Branch 0 taken 487109 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 11664 times.
✓ Branch 3 taken 475445 times.
|
487109 | if (script->valid()) |
| 13362 | { | ||
| 13363 |
1/2✓ Branch 0 taken 11664 times.
✗ Branch 1 not taken.
|
11664 | zs->script_datas.push_back(script); |
| 13364 |
1/2✓ Branch 0 taken 11664 times.
✗ Branch 1 not taken.
|
11664 | read_scripts.push_back(script); |
| 13365 | 11664 | } | |
| 13366 | |||
| 13367 | 487109 | return 0; | |
| 13368 | 554949 | } | |
| 13369 | |||
| 13370 | extern SAMPLE customsfxdata[WAV_COUNT]; | ||
| 13371 | extern uint8_t customsfxflag[WAV_COUNT>>3]; | ||
| 13372 | extern int32_t sfxdat; | ||
| 13373 | extern DATAFILE *sfxdata; | ||
| 13374 | const char *old_sfx_string[Z35] = | ||
| 13375 | { | ||
| 13376 | "Arrow", "Sword beam", "Bomb blast", "Boomerang", "Subscreen cursor", | ||
| 13377 | "Shield is hit", "Item chime", "Roar (Dodongo, Gohma)", "Shutter", "Enemy dies", | ||
| 13378 | "Enemy is hit", "Low hearts warning", "Fire", "Ganon's fanfare", "Boss is hit", "Hammer", | ||
| 13379 | "Hookshot", "Message", "Hero is hit", "Item fanfare", "Bomb placed", "Item pickup", | ||
| 13380 | "Refill", "Roar (Aquamentus, Gleeok, Ganon)", "Item pickup 2", "Ocean ambience", | ||
| 13381 | "Secret chime", "Hero dies", "Stairs", "Sword", "Roar (Manhandla, Digdogger, Patra)", | ||
| 13382 | "Wand magic", "Whistle", "Zelda's fanfare", "Charging weapon", "Charging weapon 2", | ||
| 13383 | "Divine Fire", "Enemy falls from ceiling", "Divine Escape", "Fireball", "Tall Grass slashed", | ||
| 13384 | "Pound pounded", "Hover Boots", "Ice magic", "Jump", "Lens of Truth off", "Lens of Truth on", | ||
| 13385 | "Divine Protection shield", "Divine Protection 2", "Push block", "Rock", "Spell rocket down", | ||
| 13386 | "Spell rocket up", "Sword spin attack", "Splash", "Summon magic", "Sword tapping", | ||
| 13387 | "Sword tapping (secret)", "Whistle whirlwind", "Cane of Byrna orbit" | ||
| 13388 | }; | ||
| 13389 | char *sfx_string[WAV_COUNT]; | ||
| 13390 | |||
| 13391 | 396 | int32_t readsfx(PACKFILE *f, zquestheader *Header) | |
| 13392 | { | ||
| 13393 | //these are here to bypass compiler warnings about unused arguments | ||
| 13394 | 396 | Header=Header; | |
| 13395 | |||
| 13396 | int32_t dummy; | ||
| 13397 | 396 | word s_version=0; | |
| 13398 | //int32_t ret; | ||
| 13399 | 396 | SAMPLE temp_sample = {}; | |
| 13400 | 396 | temp_sample.loop_start=0; | |
| 13401 | 396 | temp_sample.loop_end=0; | |
| 13402 | 396 | temp_sample.param=0; | |
| 13403 | |||
| 13404 | //section version info | ||
| 13405 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 396 times.
|
396 | if(!p_igetw(&s_version,f)) |
| 13406 | { | ||
| 13407 | ✗ | return qe_invalid; | |
| 13408 | } | ||
| 13409 | |||
| 13410 | 396 | FFCore.quest_format[vSFX] = s_version; | |
| 13411 | |||
| 13412 |
1/2✓ Branch 0 taken 396 times.
✗ Branch 1 not taken.
|
396 | if(!read_deprecated_section_cversion(f)) |
| 13413 | { | ||
| 13414 | ✗ | return qe_invalid; | |
| 13415 | } | ||
| 13416 | |||
| 13417 | //section size | ||
| 13418 |
1/2✓ Branch 0 taken 396 times.
✗ Branch 1 not taken.
|
396 | if(!p_igetl(&dummy,f)) |
| 13419 | { | ||
| 13420 | ✗ | return qe_invalid; | |
| 13421 | } | ||
| 13422 | |||
| 13423 | /* HIGHLY UNORTHODOX UPDATING THING, by L | ||
| 13424 | * This fixes quests made before revision 411 (such as the 'Lost Isle Build'), | ||
| 13425 | * where the meaning of GOTOLESS changed. It also coincided with V_SFX | ||
| 13426 | * changing from 1 to 2. | ||
| 13427 | */ | ||
| 13428 |
1/2✓ Branch 0 taken 396 times.
✗ Branch 1 not taken.
|
396 | if(s_version < 2) |
| 13429 | ✗ | set_qr(qr_GOTOLESSNOTEQUAL,1); | |
| 13430 | |||
| 13431 | /* End highly unorthodox updating thing */ | ||
| 13432 | |||
| 13433 | 396 | int32_t wavcount = WAV_COUNT; | |
| 13434 | |||
| 13435 |
1/2✓ Branch 0 taken 396 times.
✗ Branch 1 not taken.
|
396 | if(s_version < 6) |
| 13436 | ✗ | wavcount = 128; | |
| 13437 | |||
| 13438 | uint8_t tempflag[WAV_COUNT>>3]; | ||
| 13439 | |||
| 13440 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 396 times.
|
396 | if(s_version < 4) |
| 13441 | { | ||
| 13442 | ✗ | memset(tempflag, 0xFF, WAV_COUNT>>3); | |
| 13443 | ✗ | } | |
| 13444 | else | ||
| 13445 | { | ||
| 13446 |
1/2✓ Branch 0 taken 396 times.
✗ Branch 1 not taken.
|
396 | if(s_version < 6) |
| 13447 | ✗ | memset(tempflag, 0, WAV_COUNT>>3); | |
| 13448 | |||
| 13449 |
2/2✓ Branch 0 taken 12672 times.
✓ Branch 1 taken 396 times.
|
13068 | for(int32_t i=0; i<(wavcount>>3); i++) |
| 13450 | { | ||
| 13451 | 12672 | p_getc(&tempflag[i], f); | |
| 13452 | 12672 | } | |
| 13453 | |||
| 13454 | } | ||
| 13455 | |||
| 13456 |
1/2✓ Branch 0 taken 396 times.
✗ Branch 1 not taken.
|
396 | if(s_version>4) |
| 13457 | { | ||
| 13458 |
2/2✓ Branch 0 taken 100980 times.
✓ Branch 1 taken 396 times.
|
101376 | for(int32_t i=1; i<WAV_COUNT; i++) |
| 13459 | { | ||
| 13460 | 100980 | sprintf(sfx_string[i],"s%03d",i); | |
| 13461 | |||
| 13462 |
2/2✓ Branch 0 taken 77220 times.
✓ Branch 1 taken 23760 times.
|
100980 | if((i<Z35)) |
| 13463 | 23760 | strcpy(sfx_string[i], old_sfx_string[i-1]); | |
| 13464 | |||
| 13465 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 100980 times.
|
100980 | if(i>=wavcount) |
| 13466 | ✗ | continue; | |
| 13467 |
2/2✓ Branch 0 taken 20629 times.
✓ Branch 1 taken 80351 times.
|
100980 | if(get_bit(tempflag, i-1)) |
| 13468 | { | ||
| 13469 | char tempname[36]; | ||
| 13470 | |||
| 13471 |
1/2✓ Branch 0 taken 20629 times.
✗ Branch 1 not taken.
|
20629 | if(!pfread(tempname, 36, f)) |
| 13472 | { | ||
| 13473 | ✗ | return qe_invalid; | |
| 13474 | } | ||
| 13475 | |||
| 13476 | 20629 | sfx_string[i][0] = '\0'; | |
| 13477 | 20629 | strncat(sfx_string[i], tempname, 36 - 1); | |
| 13478 | 20629 | } | |
| 13479 | else | ||
| 13480 | { | ||
| 13481 | 80351 | sprintf(sfx_string[i],"s%03d",i); | |
| 13482 | |||
| 13483 |
2/2✓ Branch 0 taken 70661 times.
✓ Branch 1 taken 9690 times.
|
80351 | if(i<Z35) |
| 13484 | 9690 | strcpy(sfx_string[i], old_sfx_string[i-1]); | |
| 13485 | 80351 | sfx_string[i][35] = 0; //Force NULL Termination | |
| 13486 | } | ||
| 13487 | 100980 | } | |
| 13488 | 396 | } | |
| 13489 | else | ||
| 13490 | { | ||
| 13491 | ✗ | for(int32_t i=1; i<WAV_COUNT; i++) | |
| 13492 | { | ||
| 13493 | ✗ | sprintf(sfx_string[i],"s%03d",i); | |
| 13494 | |||
| 13495 | ✗ | if(i<Z35) | |
| 13496 | ✗ | strcpy(sfx_string[i], old_sfx_string[i-1]); | |
| 13497 | ✗ | } | |
| 13498 | } | ||
| 13499 | |||
| 13500 | //finally... section data | ||
| 13501 |
2/2✓ Branch 0 taken 100980 times.
✓ Branch 1 taken 396 times.
|
101376 | for(int32_t i=1; i<wavcount; i++) |
| 13502 | { | ||
| 13503 |
2/2✓ Branch 0 taken 20629 times.
✓ Branch 1 taken 80351 times.
|
100980 | if(get_bit(tempflag, i-1)) |
| 13504 | { | ||
| 13505 | |||
| 13506 |
1/2✓ Branch 0 taken 20629 times.
✗ Branch 1 not taken.
|
20629 | if(!p_igetl(&dummy,f)) |
| 13507 | { | ||
| 13508 | ✗ | return qe_invalid; | |
| 13509 | } | ||
| 13510 | |||
| 13511 | 20629 | (temp_sample.bits) = dummy; | |
| 13512 | |||
| 13513 |
1/2✓ Branch 0 taken 20629 times.
✗ Branch 1 not taken.
|
20629 | if(!p_igetl(&dummy,f)) |
| 13514 | { | ||
| 13515 | ✗ | return qe_invalid; | |
| 13516 | } | ||
| 13517 | |||
| 13518 | 20629 | (temp_sample.stereo) = dummy; | |
| 13519 | |||
| 13520 |
1/2✓ Branch 0 taken 20629 times.
✗ Branch 1 not taken.
|
20629 | if(!p_igetl(&dummy,f)) |
| 13521 | { | ||
| 13522 | ✗ | return qe_invalid; | |
| 13523 | } | ||
| 13524 | |||
| 13525 | 20629 | (temp_sample.freq) = dummy; | |
| 13526 | |||
| 13527 |
1/2✓ Branch 0 taken 20629 times.
✗ Branch 1 not taken.
|
20629 | if(!p_igetl(&dummy,f)) |
| 13528 | { | ||
| 13529 | ✗ | return qe_invalid; | |
| 13530 | } | ||
| 13531 | |||
| 13532 | 20629 | (temp_sample.priority) = dummy; | |
| 13533 | |||
| 13534 |
1/2✓ Branch 0 taken 20629 times.
✗ Branch 1 not taken.
|
20629 | if(!p_igetl(&(temp_sample.len),f)) |
| 13535 | { | ||
| 13536 | ✗ | return qe_invalid; | |
| 13537 | } | ||
| 13538 | |||
| 13539 |
1/2✓ Branch 0 taken 20629 times.
✗ Branch 1 not taken.
|
20629 | if(!p_igetl(&(temp_sample.loop_start),f)) |
| 13540 | { | ||
| 13541 | ✗ | return qe_invalid; | |
| 13542 | } | ||
| 13543 | |||
| 13544 |
1/2✓ Branch 0 taken 20629 times.
✗ Branch 1 not taken.
|
20629 | if(!p_igetl(&(temp_sample.loop_end),f)) |
| 13545 | { | ||
| 13546 | ✗ | return qe_invalid; | |
| 13547 | } | ||
| 13548 | |||
| 13549 |
1/2✓ Branch 0 taken 20629 times.
✗ Branch 1 not taken.
|
20629 | if(!p_igetl(&(temp_sample.param),f)) |
| 13550 | { | ||
| 13551 | ✗ | return qe_invalid; | |
| 13552 | } | ||
| 13553 | |||
| 13554 | 20629 | auto len = (temp_sample.bits==8?1:2)*(temp_sample.stereo==0?1:2)*temp_sample.len; | |
| 13555 | #ifdef ZC_FUZZ | ||
| 13556 | const int32_t sfx_limit = 100000; | ||
| 13557 | if (len < 0 || len > sfx_limit) | ||
| 13558 | { | ||
| 13559 | return qe_invalid; | ||
| 13560 | } | ||
| 13561 | #endif | ||
| 13562 | 20629 | temp_sample.data = calloc(len,1); | |
| 13563 | |||
| 13564 |
1/2✓ Branch 0 taken 20629 times.
✗ Branch 1 not taken.
|
20629 | if(s_version < 3) |
| 13565 | ✗ | len = (temp_sample.bits==8?1:2)*temp_sample.len; | |
| 13566 | |||
| 13567 | //old-style, non-portable loading (Bad Allegro! Bad!!) -DD | ||
| 13568 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 20629 times.
|
20629 | if(s_version < 2) |
| 13569 | { | ||
| 13570 | ✗ | if(!pfread(temp_sample.data, len,f)) | |
| 13571 | { | ||
| 13572 | ✗ | return qe_invalid; | |
| 13573 | } | ||
| 13574 | ✗ | } | |
| 13575 | else | ||
| 13576 | { | ||
| 13577 | //re-endianfy the data | ||
| 13578 | 20629 | int32_t wordstoread = len / sizeof(word); | |
| 13579 | |||
| 13580 |
2/2✓ Branch 0 taken 565564716 times.
✓ Branch 1 taken 20629 times.
|
565585345 | for(int32_t j=0; j<wordstoread; j++) |
| 13581 | { | ||
| 13582 | word temp; | ||
| 13583 | |||
| 13584 |
1/2✓ Branch 0 taken 565564716 times.
✗ Branch 1 not taken.
|
565564716 | if(!p_igetw(&temp, f)) |
| 13585 | { | ||
| 13586 | ✗ | return qe_invalid; | |
| 13587 | } | ||
| 13588 | |||
| 13589 | 565564716 | ((word *)temp_sample.data)[j] = temp; | |
| 13590 | 565564716 | } | |
| 13591 | } | ||
| 13592 | 20629 | } | |
| 13593 |
2/2✓ Branch 0 taken 9690 times.
✓ Branch 1 taken 70661 times.
|
80351 | else if(i < Z35) |
| 13594 | { | ||
| 13595 | 9690 | SAMPLE* datsamp = (SAMPLE*)(sfxdata[i].dat); | |
| 13596 | 9690 | memcpy(&temp_sample, datsamp, sizeof(SAMPLE)); | |
| 13597 | 9690 | set_bit(tempflag, i-1, 1); | |
| 13598 | 9690 | int32_t len = (temp_sample.bits==8?1:2)*(temp_sample.stereo==0?1:2)*temp_sample.len; | |
| 13599 | 9690 | temp_sample.data = calloc(len,1); | |
| 13600 | 9690 | memcpy(temp_sample.data, datsamp->data, len); | |
| 13601 | 9690 | } | |
| 13602 | 70661 | else continue; | |
| 13603 | |||
| 13604 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 30319 times.
|
30319 | if(customsfxdata[i].data!=NULL) |
| 13605 | { | ||
| 13606 | // delete [] customsfxdata[i].data; | ||
| 13607 | 30319 | free(customsfxdata[i].data); | |
| 13608 | 30319 | } | |
| 13609 | |||
| 13610 | // customsfxdata[i].data = new byte[(temp_sample.bits==8?1:2)*temp_sample.len]; | ||
| 13611 | 30319 | int32_t len2 = (temp_sample.bits==8?1:2)*(temp_sample.stereo==0?1:2)*temp_sample.len; | |
| 13612 | 30319 | customsfxdata[i].data = calloc(len2,1); | |
| 13613 | 30319 | customsfxdata[i].bits = temp_sample.bits; | |
| 13614 | 30319 | customsfxdata[i].stereo = temp_sample.stereo; | |
| 13615 | 30319 | customsfxdata[i].freq = temp_sample.freq; | |
| 13616 | 30319 | customsfxdata[i].priority = temp_sample.priority; | |
| 13617 | 30319 | customsfxdata[i].len = temp_sample.len; | |
| 13618 | 30319 | customsfxdata[i].loop_start = temp_sample.loop_start; | |
| 13619 | 30319 | customsfxdata[i].loop_end = temp_sample.loop_end; | |
| 13620 | 30319 | customsfxdata[i].param = temp_sample.param; | |
| 13621 | 30319 | int32_t cpylen = len2; | |
| 13622 | |||
| 13623 |
1/2✓ Branch 0 taken 30319 times.
✗ Branch 1 not taken.
|
30319 | if(s_version<3) |
| 13624 | { | ||
| 13625 | ✗ | cpylen = (temp_sample.bits==8?1:2)*temp_sample.len; | |
| 13626 | ✗ | al_trace("WARNING: Quest SFX %d is in stereo, and may be corrupt.\n",i); | |
| 13627 | ✗ | } | |
| 13628 | |||
| 13629 | 30319 | memcpy(customsfxdata[i].data,temp_sample.data,cpylen); | |
| 13630 | |||
| 13631 | 30319 | free(temp_sample.data); | |
| 13632 | 30319 | } | |
| 13633 | |||
| 13634 | 396 | memcpy(customsfxflag, tempflag, WAV_COUNT>>3); | |
| 13635 | |||
| 13636 | 396 | sfxdat=0; | |
| 13637 | 396 | return 0; | |
| 13638 | 396 | } | |
| 13639 | |||
| 13640 | 478 | void setupsfx() | |
| 13641 | { | ||
| 13642 |
2/2✓ Branch 0 taken 121890 times.
✓ Branch 1 taken 478 times.
|
122368 | for(int32_t i=1; i<WAV_COUNT; i++) |
| 13643 | { | ||
| 13644 | 121890 | sprintf(sfx_string[i],"s%03d",i); | |
| 13645 | |||
| 13646 |
2/2✓ Branch 0 taken 93210 times.
✓ Branch 1 taken 28680 times.
|
121890 | if(i<Z35) |
| 13647 | { | ||
| 13648 | 28680 | strcpy(sfx_string[i], old_sfx_string[i-1]); | |
| 13649 | 28680 | } | |
| 13650 | |||
| 13651 | 121890 | memset(customsfxflag, 0, WAV_COUNT>>3); | |
| 13652 | |||
| 13653 | 121890 | int32_t j=i; | |
| 13654 | |||
| 13655 |
2/2✓ Branch 0 taken 29158 times.
✓ Branch 1 taken 92732 times.
|
121890 | if(i>Z35) |
| 13656 | { | ||
| 13657 | 92732 | i=Z35; | |
| 13658 | 92732 | } | |
| 13659 | |||
| 13660 | 121890 | SAMPLE *temp_sample = (SAMPLE *)sfxdata[i].dat; | |
| 13661 | |||
| 13662 |
2/2✓ Branch 0 taken 94095 times.
✓ Branch 1 taken 27795 times.
|
121890 | if(customsfxdata[j].data!=NULL) |
| 13663 | { | ||
| 13664 | // delete [] customsfxdata[j].data; | ||
| 13665 | 27795 | free(customsfxdata[j].data); | |
| 13666 | 27795 | } | |
| 13667 | |||
| 13668 | // customsfxdata[j].data = new byte[(temp_sample->bits==8?1:2)*temp_sample->len]; | ||
| 13669 | 121890 | customsfxdata[j].data = calloc((temp_sample->bits==8?1:2)*(temp_sample->stereo == 0 ? 1 : 2)*temp_sample->len,1); | |
| 13670 | 121890 | customsfxdata[j].bits = temp_sample->bits; | |
| 13671 | 121890 | customsfxdata[j].stereo = temp_sample->stereo; | |
| 13672 | 121890 | customsfxdata[j].freq = temp_sample->freq; | |
| 13673 | 121890 | customsfxdata[j].priority = temp_sample->priority; | |
| 13674 | 121890 | customsfxdata[j].len = temp_sample->len; | |
| 13675 | 121890 | customsfxdata[j].loop_start = temp_sample->loop_start; | |
| 13676 | 121890 | customsfxdata[j].loop_end = temp_sample->loop_end; | |
| 13677 | 121890 | customsfxdata[j].param = temp_sample->param; | |
| 13678 | 121890 | memcpy(customsfxdata[j].data, (temp_sample->data), (temp_sample->bits==8?1:2)*(temp_sample->stereo==0 ? 1 : 2)*temp_sample->len); | |
| 13679 | 121890 | i=j; | |
| 13680 | 121890 | } | |
| 13681 | 478 | } | |
| 13682 | |||
| 13683 | extern char *guy_string[eMAXGUYS]; | ||
| 13684 | extern const char *old_guy_string[OLDMAXGUYS]; | ||
| 13685 | |||
| 13686 | 478 | int32_t readguys(PACKFILE *f, zquestheader *Header) | |
| 13687 | { | ||
| 13688 |
2/2✓ Branch 0 taken 455 times.
✓ Branch 1 taken 23 times.
|
478 | bool should_skip = legacy_skip_flags && get_bit(legacy_skip_flags, skip_guys); |
| 13689 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 478 times.
|
478 | if (should_skip) return 0; |
| 13690 | |||
| 13691 | dword dummy; | ||
| 13692 | word guy_cversion; | ||
| 13693 | 478 | word guyversion=0; | |
| 13694 | |||
| 13695 |
2/2✓ Branch 0 taken 23 times.
✓ Branch 1 taken 455 times.
|
478 | if(Header->zelda_version >= 0x193) |
| 13696 | { | ||
| 13697 | //section version info | ||
| 13698 |
1/2✓ Branch 0 taken 455 times.
✗ Branch 1 not taken.
|
455 | if(!p_igetw(&guyversion,f)) |
| 13699 | { | ||
| 13700 | ✗ | return qe_invalid; | |
| 13701 | } | ||
| 13702 | |||
| 13703 | 455 | FFCore.quest_format[vGuys] = guyversion; | |
| 13704 | |||
| 13705 | // Note: this is the only instance where "cversion" is ever used. | ||
| 13706 |
1/2✓ Branch 0 taken 455 times.
✗ Branch 1 not taken.
|
455 | if(!p_igetw(&guy_cversion,f)) |
| 13707 | { | ||
| 13708 | ✗ | return qe_invalid; | |
| 13709 | } | ||
| 13710 | |||
| 13711 | //section size | ||
| 13712 |
1/2✓ Branch 0 taken 455 times.
✗ Branch 1 not taken.
|
455 | if(!p_igetl(&dummy,f)) |
| 13713 | { | ||
| 13714 | ✗ | return qe_invalid; | |
| 13715 | } | ||
| 13716 | 455 | } | |
| 13717 | |||
| 13718 |
2/2✓ Branch 0 taken 396 times.
✓ Branch 1 taken 82 times.
|
478 | if(guyversion > 3) |
| 13719 | { | ||
| 13720 |
2/2✓ Branch 0 taken 202752 times.
✓ Branch 1 taken 396 times.
|
203148 | for(int32_t i=0; i<MAXGUYS; i++) |
| 13721 | { | ||
| 13722 | char tempname[64]; | ||
| 13723 | |||
| 13724 | // rev. 1511 : guyversion = 23. upped to 512 editable enemies. -Gleeok | ||
| 13725 | // if guyversion < 23 then there is only 256 enemies in the packfile, so default the rest. | ||
| 13726 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 202752 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
202752 | if(guyversion < 23 && i >= OLDBETAMAXGUYS) |
| 13727 | { | ||
| 13728 | ✗ | memset(tempname, 0, sizeof(char)*64); | |
| 13729 | ✗ | sprintf(tempname, "e%03d", i); | |
| 13730 | ✗ | strcpy(guy_string[i], tempname); | |
| 13731 | |||
| 13732 | ✗ | continue; | |
| 13733 | } | ||
| 13734 | |||
| 13735 |
1/2✓ Branch 0 taken 202752 times.
✗ Branch 1 not taken.
|
202752 | if(!pfread(tempname, 64, f)) |
| 13736 | { | ||
| 13737 | ✗ | return qe_invalid; | |
| 13738 | } | ||
| 13739 | |||
| 13740 | // Don't retain names of uneditable enemy entries! | ||
| 13741 | // for version upgrade to 2.5 | ||
| 13742 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 202752 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
202752 | if(guyversion < 23 && i >= 177) |
| 13743 | { | ||
| 13744 | // some of the older builds have names such as 'zz123', | ||
| 13745 | // (this order gets messed up with some eXXX and some zzXXX) | ||
| 13746 | // so let's update to the newer naming convection. -Gleeok | ||
| 13747 | char tmpbuf[64]; | ||
| 13748 | ✗ | memset(tmpbuf, 0, sizeof(char)*64); | |
| 13749 | ✗ | sprintf(tmpbuf, "zz%03d", i); | |
| 13750 | |||
| 13751 | ✗ | if(memcmp(tempname, tmpbuf, size_t(5)) == 0) | |
| 13752 | { | ||
| 13753 | ✗ | memset(tempname, 0, sizeof(char)*64); | |
| 13754 | ✗ | sprintf(tempname, "e%03d", i); | |
| 13755 | ✗ | } | |
| 13756 | ✗ | } | |
| 13757 | |||
| 13758 |
6/6✓ Branch 0 taken 70092 times.
✓ Branch 1 taken 132660 times.
✓ Branch 2 taken 66528 times.
✓ Branch 3 taken 3564 times.
✓ Branch 4 taken 57948 times.
✓ Branch 5 taken 8580 times.
|
202752 | if(i >= OLDMAXGUYS || strlen(tempname)<1 || tempname[strlen(tempname)-1]!=' ') |
| 13759 | { | ||
| 13760 | 194172 | guy_string[i][0] = '\0'; | |
| 13761 | 194172 | strncat(guy_string[i], tempname, 64 - 1); | |
| 13762 | 194172 | } | |
| 13763 | else | ||
| 13764 | { | ||
| 13765 | 8580 | strcpy(guy_string[i],old_guy_string[i]); | |
| 13766 | } | ||
| 13767 | 202752 | } | |
| 13768 | 396 | } | |
| 13769 | else | ||
| 13770 | { | ||
| 13771 |
2/2✓ Branch 0 taken 41984 times.
✓ Branch 1 taken 82 times.
|
42066 | for(int32_t i=0; i<eMAXGUYS; i++) |
| 13772 | { | ||
| 13773 | 41984 | sprintf(guy_string[i],"zz%03d",i); | |
| 13774 | 41984 | } | |
| 13775 | |||
| 13776 |
2/2✓ Branch 0 taken 14514 times.
✓ Branch 1 taken 82 times.
|
14596 | for(int32_t i=0; i<OLDMAXGUYS; i++) |
| 13777 | { | ||
| 13778 | 14514 | strcpy(guy_string[i],old_guy_string[i]); | |
| 13779 | 14514 | } | |
| 13780 | } | ||
| 13781 | |||
| 13782 | |||
| 13783 | //finally... section data | ||
| 13784 | 478 | init_guys(guyversion); //using default data for now... | |
| 13785 | |||
| 13786 | // Goriya guy fix | ||
| 13787 |
3/6✓ Branch 0 taken 396 times.
✓ Branch 1 taken 82 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 396 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
478 | if((Header->zelda_version < 0x211)||((Header->zelda_version == 0x211)&&(Header->build<7))) |
| 13788 | { | ||
| 13789 |
2/2✓ Branch 0 taken 22 times.
✓ Branch 1 taken 60 times.
|
82 | if(get_qr(qr_NEWENEMYTILES)) |
| 13790 | { | ||
| 13791 | 60 | guysbuf[gGORIYA].tile=130; | |
| 13792 | 60 | guysbuf[gGORIYA].e_tile=130; | |
| 13793 | 60 | } | |
| 13794 | 82 | } | |
| 13795 | |||
| 13796 |
2/2✓ Branch 0 taken 455 times.
✓ Branch 1 taken 23 times.
|
478 | if(Header->zelda_version < 0x193) |
| 13797 | { | ||
| 13798 |
2/2✓ Branch 0 taken 18 times.
✓ Branch 1 taken 5 times.
|
23 | if(get_bit(deprecated_rules,46)) |
| 13799 | { | ||
| 13800 | 5 | guysbuf[eDODONGO].cset=14; | |
| 13801 | 5 | guysbuf[eDODONGO].bosspal=spDIG; | |
| 13802 | 5 | } | |
| 13803 | 23 | } | |
| 13804 | // Not sure when this first changed, but it's necessary for 2.10, at least | ||
| 13805 | // @TODO: @BUG:1.92 - 1.84? Figure this out exactly for the final 2.50 release. | ||
| 13806 | //2.10 Fixes | ||
| 13807 |
3/6✓ Branch 0 taken 396 times.
✓ Branch 1 taken 82 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 396 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
478 | if((Header->zelda_version < 0x211)||((Header->zelda_version == 0x211)&&(Header->build<18))) |
| 13808 | { | ||
| 13809 | 82 | guysbuf[eWWIZ].editorflags |= ENEMY_FLAG5; | |
| 13810 | 82 | guysbuf[eMOLDORM].editorflags |= ENEMY_FLAG6; | |
| 13811 | 82 | guysbuf[eMANHAN].editorflags |= ENEMY_FLAG6; | |
| 13812 | 82 | guysbuf[eCENT1].attributes[2] = 1; | |
| 13813 | 82 | guysbuf[eCENT2].attributes[2] = 1; | |
| 13814 | 82 | } | |
| 13815 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 478 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
478 | if((Header->zelda_version <= 0x255) || (Header->zelda_version == 0x255 && Header->build < 47) ) |
| 13816 | { | ||
| 13817 | 478 | guysbuf[eWPOLSV].defense[edefWhistle] = ed1HKO; | |
| 13818 | 478 | } | |
| 13819 |
2/2✓ Branch 0 taken 396 times.
✓ Branch 1 taken 82 times.
|
478 | if(Header->zelda_version <= 0x210) |
| 13820 | { | ||
| 13821 | 82 | guysbuf[eGLEEOK1F].attributes[5] = 16; | |
| 13822 | 82 | guysbuf[eGLEEOK2F].attributes[5] = 16; | |
| 13823 | 82 | guysbuf[eGLEEOK3F].attributes[5] = 16; | |
| 13824 | 82 | guysbuf[eGLEEOK4F].attributes[5] = 16; | |
| 13825 | |||
| 13826 | 82 | guysbuf[eWIZ1].attributes[3] = 1; //only set the enemy that needs backward compat, not all of them. | |
| 13827 | 82 | guysbuf[eBATROBE].attributes[3] = 1; | |
| 13828 | //guysbuf[eSUMMONER].misc4 = 1; | ||
| 13829 | 82 | guysbuf[eWWIZ].attributes[3] = 1; | |
| 13830 | 82 | guysbuf[eDODONGO].deadsfx = 15; //In 2.10 and earlier, Dodongos used this as their death sound. | |
| 13831 | 82 | guysbuf[eDODONGOBS].deadsfx = 15; //In 2.10 and earlier, Dodongos used this as their death sound. | |
| 13832 | 82 | } | |
| 13833 |
2/2✓ Branch 0 taken 466 times.
✓ Branch 1 taken 12 times.
|
478 | if(Header->zelda_version == 0x190) |
| 13834 | { | ||
| 13835 | 12 | al_trace("Setting Tribble Properties for Version: %x", Header->zelda_version); | |
| 13836 | 12 | guysbuf[eKEESETRIB].attributes[2] = eVIRE; //1.90 and earlier, keese and gel tribbles grew up into | |
| 13837 | 12 | guysbuf[eGELTRIB].attributes[2] = eZOL; //normal vires, and zols -Z (16th January, 2019 ) | |
| 13838 | 12 | } | |
| 13839 | |||
| 13840 | // The versions here may not be correct | ||
| 13841 | // zelda_version>=0x211 handled at guyversion<24 | ||
| 13842 |
2/2✓ Branch 0 taken 18 times.
✓ Branch 1 taken 460 times.
|
478 | if(Header->zelda_version <= 0x190) |
| 13843 | { | ||
| 13844 | 18 | guysbuf[eCENT1].attributes[2] = 0; | |
| 13845 | 18 | guysbuf[eCENT2].attributes[2] = 0; | |
| 13846 | 18 | guysbuf[eMOLDORM].attributes[1] = 0; | |
| 13847 | //guysbuf[eKEESETRIB].misc3 = eVIRE; //1.90 and earlier, keese and gel tribbles grew up into | ||
| 13848 | //guysbuf[eGELTRIB].misc3 = eZOL; //normal vires, and zols -Z (16th January, 2019 ) | ||
| 13849 | 18 | } | |
| 13850 |
2/2✓ Branch 0 taken 396 times.
✓ Branch 1 taken 64 times.
|
460 | else if(Header->zelda_version <= 0x210) |
| 13851 | { | ||
| 13852 | 64 | guysbuf[eCENT1].attributes[2] = 1; | |
| 13853 | 64 | guysbuf[eCENT2].attributes[2] = 1; | |
| 13854 | 64 | guysbuf[eMOLDORM].attributes[1] = 0; | |
| 13855 | 64 | } | |
| 13856 | |||
| 13857 |
2/2✓ Branch 0 taken 396 times.
✓ Branch 1 taken 82 times.
|
478 | if ( Header->zelda_version < 0x211 ) //Default rest rates for phantom ghinis, peahats and keese in < 2.50 quests |
| 13858 | { | ||
| 13859 | 82 | guysbuf[eKEESE1].attributes[15] = 120; | |
| 13860 | 82 | guysbuf[eKEESE2].attributes[15] = 120; | |
| 13861 | 82 | guysbuf[eKEESE3].attributes[15] = 120; | |
| 13862 | 82 | guysbuf[eKEESETRIB].attributes[15] = 120; | |
| 13863 | 82 | guysbuf[eKEESE1].attributes[16] = 16; | |
| 13864 | 82 | guysbuf[eKEESE2].attributes[16] = 16; | |
| 13865 | 82 | guysbuf[eKEESE3].attributes[16] = 16; | |
| 13866 | 82 | guysbuf[eKEESETRIB].attributes[16] = 16; | |
| 13867 | |||
| 13868 | 82 | guysbuf[ePEAHAT].attributes[15] = 80; | |
| 13869 | 82 | guysbuf[ePEAHAT].attributes[16] = 16; | |
| 13870 | |||
| 13871 | 82 | guysbuf[eGHINI2].attributes[15] = 120; | |
| 13872 | 82 | guysbuf[eGHINI2].attributes[16] = 10; | |
| 13873 | |||
| 13874 |
2/2✓ Branch 0 taken 16 times.
✓ Branch 1 taken 66 times.
|
82 | if (replay_version_check(20)) |
| 13875 | { | ||
| 13876 | 66 | guysbuf[eGHINI2].moveflags |= (move_can_waterwalk|move_can_pitwalk); | |
| 13877 | 66 | guysbuf[eMOLDORM].moveflags |= (move_can_waterwalk|move_can_pitwalk); | |
| 13878 | 66 | guysbuf[eKEESETRIB].moveflags |= (move_can_waterwalk|move_can_pitwalk); | |
| 13879 | 66 | guysbuf[eKEESE3].moveflags |= (move_can_waterwalk|move_can_pitwalk); | |
| 13880 | 66 | guysbuf[eKEESE2].moveflags |= (move_can_waterwalk|move_can_pitwalk); | |
| 13881 | 66 | guysbuf[eKEESE1].moveflags |= (move_can_waterwalk|move_can_pitwalk); | |
| 13882 | 66 | guysbuf[eTEK1].moveflags |= (move_can_waterwalk|move_can_pitwalk); | |
| 13883 | 66 | guysbuf[eTEK2].moveflags |= (move_can_waterwalk|move_can_pitwalk); | |
| 13884 | 66 | guysbuf[ePEAHAT].moveflags |= (move_can_waterwalk|move_can_pitwalk); | |
| 13885 | 66 | guysbuf[eROCK].moveflags |= (move_can_waterwalk|move_can_pitwalk); | |
| 13886 | 66 | guysbuf[eTRAP].moveflags |= (move_can_waterwalk|move_can_pitwalk); | |
| 13887 | 66 | guysbuf[eWALLM].moveflags |= (move_can_waterwalk|move_can_pitwalk); | |
| 13888 | 66 | guysbuf[ePOLSV].moveflags |= (move_can_waterwalk|move_can_pitwalk); | |
| 13889 | 66 | guysbuf[eMANHAN].moveflags |= (move_can_waterwalk|move_can_pitwalk); | |
| 13890 | 66 | guysbuf[eGLEEOK1].moveflags |= (move_can_waterwalk|move_can_pitwalk); | |
| 13891 | 66 | guysbuf[eGLEEOK2].moveflags |= (move_can_waterwalk|move_can_pitwalk); | |
| 13892 | 66 | guysbuf[eGLEEOK3].moveflags |= (move_can_waterwalk|move_can_pitwalk); | |
| 13893 | 66 | guysbuf[eGLEEOK4].moveflags |= (move_can_waterwalk|move_can_pitwalk); | |
| 13894 | 66 | guysbuf[eDIG1].moveflags |= (move_can_waterwalk|move_can_pitwalk); | |
| 13895 | 66 | guysbuf[eDIG3].moveflags |= (move_can_waterwalk|move_can_pitwalk); | |
| 13896 | 66 | guysbuf[eDIGPUP1].moveflags |= (move_can_waterwalk|move_can_pitwalk); | |
| 13897 | 66 | guysbuf[eDIGPUP2].moveflags |= (move_can_waterwalk|move_can_pitwalk); | |
| 13898 | 66 | guysbuf[eDIGPUP3].moveflags |= (move_can_waterwalk|move_can_pitwalk); | |
| 13899 | 66 | guysbuf[eDIGPUP4].moveflags |= (move_can_waterwalk|move_can_pitwalk); | |
| 13900 | 66 | guysbuf[eRAQUAM].moveflags |= (move_can_waterwalk|move_can_pitwalk); | |
| 13901 | 66 | guysbuf[eITEMFAIRY].moveflags |= (move_can_waterwalk|move_can_pitwalk); | |
| 13902 | 66 | guysbuf[eFIRE].moveflags |= (move_can_waterwalk|move_can_pitwalk); | |
| 13903 | 66 | guysbuf[eMANHAN2].moveflags |= (move_can_waterwalk|move_can_pitwalk); | |
| 13904 | 66 | guysbuf[eTRAP_H].moveflags |= (move_can_waterwalk|move_can_pitwalk); | |
| 13905 | 66 | guysbuf[eTRAP_V].moveflags |= (move_can_waterwalk|move_can_pitwalk); | |
| 13906 | 66 | guysbuf[eTRAP_LR].moveflags |= (move_can_waterwalk|move_can_pitwalk); | |
| 13907 | 66 | guysbuf[eTRAP_UD].moveflags |= (move_can_waterwalk|move_can_pitwalk); | |
| 13908 | 66 | guysbuf[ePATRA1].moveflags |= (move_can_waterwalk|move_can_pitwalk); | |
| 13909 | 66 | guysbuf[ePATRA2].moveflags |= (move_can_waterwalk|move_can_pitwalk); | |
| 13910 | 66 | guysbuf[ePATRABS].moveflags |= (move_can_waterwalk|move_can_pitwalk); | |
| 13911 | 66 | guysbuf[eBAT].moveflags |= (move_can_waterwalk|move_can_pitwalk); | |
| 13912 | 66 | guysbuf[eGLEEOK1F].moveflags |= (move_can_waterwalk|move_can_pitwalk); | |
| 13913 | 66 | guysbuf[eGLEEOK2F].moveflags |= (move_can_waterwalk|move_can_pitwalk); | |
| 13914 | 66 | guysbuf[eGLEEOK3F].moveflags |= (move_can_waterwalk|move_can_pitwalk); | |
| 13915 | 66 | guysbuf[eGLEEOK4F].moveflags |= (move_can_waterwalk|move_can_pitwalk); | |
| 13916 | 66 | guysbuf[eTRIGGER].moveflags |= (move_can_waterwalk|move_can_pitwalk); | |
| 13917 | 66 | guysbuf[ePATRAL2].moveflags |= (move_can_waterwalk|move_can_pitwalk); | |
| 13918 | 66 | guysbuf[ePATRAL3].moveflags |= (move_can_waterwalk|move_can_pitwalk); | |
| 13919 | 66 | guysbuf[eGOHMA1].moveflags |= (move_can_waterwalk|move_can_pitwalk); | |
| 13920 | 66 | guysbuf[eGOHMA2].moveflags |= (move_can_waterwalk|move_can_pitwalk); | |
| 13921 | 66 | guysbuf[eGOHMA3].moveflags |= (move_can_waterwalk|move_can_pitwalk); | |
| 13922 | 66 | guysbuf[eGOHMA4].moveflags |= (move_can_waterwalk|move_can_pitwalk); | |
| 13923 | 66 | guysbuf[eMPOLSV].moveflags |= (move_can_waterwalk|move_can_pitwalk); | |
| 13924 | 66 | guysbuf[eWPOLSV].moveflags |= (move_can_waterwalk|move_can_pitwalk); | |
| 13925 | 66 | } | |
| 13926 | 82 | } | |
| 13927 | |||
| 13928 | |||
| 13929 |
2/2✓ Branch 0 taken 82 times.
✓ Branch 1 taken 396 times.
|
478 | if(guyversion<=2) |
| 13930 | { | ||
| 13931 | 82 | return readherosprites2(f, guyversion==2?0:-1); | |
| 13932 | } | ||
| 13933 | |||
| 13934 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 396 times.
|
396 | if(guyversion > 3) |
| 13935 | { | ||
| 13936 | 396 | guydata tempguy; | |
| 13937 | |||
| 13938 |
2/2✓ Branch 0 taken 202752 times.
✓ Branch 1 taken 396 times.
|
203148 | for(int32_t i=0; i<MAXGUYS; i++) |
| 13939 | { | ||
| 13940 |
1/2✓ Branch 0 taken 202752 times.
✗ Branch 1 not taken.
|
202752 | if(guyversion < 23) // May 2012 : 512 max enemies |
| 13941 | { | ||
| 13942 | ✗ | if(i >= OLDBETAMAXGUYS) | |
| 13943 | { | ||
| 13944 | ✗ | guysbuf[i].clear(); | |
| 13945 | ✗ | continue; | |
| 13946 | } | ||
| 13947 | ✗ | } | |
| 13948 | |||
| 13949 | 202752 | tempguy.clear(); | |
| 13950 | |||
| 13951 | uint32_t flags1; | ||
| 13952 | uint32_t flags2; | ||
| 13953 |
1/2✓ Branch 0 taken 202752 times.
✗ Branch 1 not taken.
|
202752 | if(!p_igetl(&(flags1),f)) |
| 13954 | { | ||
| 13955 | ✗ | return qe_invalid; | |
| 13956 | } | ||
| 13957 |
1/2✓ Branch 0 taken 202752 times.
✗ Branch 1 not taken.
|
202752 | if(!p_igetl(&(flags2),f)) |
| 13958 | { | ||
| 13959 | ✗ | return qe_invalid; | |
| 13960 | } | ||
| 13961 | 202752 | tempguy.flags = guy_flags(flags1) | guy_flags(uint64_t(flags2)<<32ULL); | |
| 13962 | |||
| 13963 |
2/2✓ Branch 0 taken 100352 times.
✓ Branch 1 taken 102400 times.
|
202752 | if ( guyversion >= 36 ) //expanded tiles |
| 13964 | { | ||
| 13965 |
1/2✓ Branch 0 taken 100352 times.
✗ Branch 1 not taken.
|
100352 | if(!p_igetl(&(tempguy.tile),f)) |
| 13966 | { | ||
| 13967 | ✗ | return qe_invalid; | |
| 13968 | } | ||
| 13969 | 100352 | } | |
| 13970 | else | ||
| 13971 | { | ||
| 13972 |
1/2✓ Branch 0 taken 102400 times.
✗ Branch 1 not taken.
|
102400 | if(!p_igetw(&(tempguy.tile),f)) |
| 13973 | { | ||
| 13974 | ✗ | return qe_invalid; | |
| 13975 | } | ||
| 13976 | } | ||
| 13977 |
1/2✓ Branch 0 taken 202752 times.
✗ Branch 1 not taken.
|
202752 | if(!p_getc(&(tempguy.width),f)) |
| 13978 | { | ||
| 13979 | ✗ | return qe_invalid; | |
| 13980 | } | ||
| 13981 | |||
| 13982 |
1/2✓ Branch 0 taken 202752 times.
✗ Branch 1 not taken.
|
202752 | if(!p_getc(&(tempguy.height),f)) |
| 13983 | { | ||
| 13984 | ✗ | return qe_invalid; | |
| 13985 | } | ||
| 13986 | |||
| 13987 |
2/2✓ Branch 0 taken 100352 times.
✓ Branch 1 taken 102400 times.
|
202752 | if ( guyversion >= 36 ) //expanded tiles |
| 13988 | { | ||
| 13989 |
1/2✓ Branch 0 taken 100352 times.
✗ Branch 1 not taken.
|
100352 | if(!p_igetl(&(tempguy.s_tile),f)) |
| 13990 | { | ||
| 13991 | ✗ | return qe_invalid; | |
| 13992 | } | ||
| 13993 | 100352 | } | |
| 13994 | else | ||
| 13995 | { | ||
| 13996 |
1/2✓ Branch 0 taken 102400 times.
✗ Branch 1 not taken.
|
102400 | if(!p_igetw(&(tempguy.s_tile),f)) |
| 13997 | { | ||
| 13998 | ✗ | return qe_invalid; | |
| 13999 | } | ||
| 14000 | } | ||
| 14001 | |||
| 14002 |
1/2✓ Branch 0 taken 202752 times.
✗ Branch 1 not taken.
|
202752 | if(!p_getc(&(tempguy.s_width),f)) |
| 14003 | { | ||
| 14004 | ✗ | return qe_invalid; | |
| 14005 | } | ||
| 14006 | |||
| 14007 |
1/2✓ Branch 0 taken 202752 times.
✗ Branch 1 not taken.
|
202752 | if(!p_getc(&(tempguy.s_height),f)) |
| 14008 | { | ||
| 14009 | ✗ | return qe_invalid; | |
| 14010 | } | ||
| 14011 | |||
| 14012 |
2/2✓ Branch 0 taken 100352 times.
✓ Branch 1 taken 102400 times.
|
202752 | if ( guyversion >= 36 ) //expanded tiles |
| 14013 | { | ||
| 14014 |
1/2✓ Branch 0 taken 100352 times.
✗ Branch 1 not taken.
|
100352 | if(!p_igetl(&(tempguy.e_tile),f)) |
| 14015 | { | ||
| 14016 | ✗ | return qe_invalid; | |
| 14017 | } | ||
| 14018 | 100352 | } | |
| 14019 | else | ||
| 14020 | { | ||
| 14021 |
1/2✓ Branch 0 taken 102400 times.
✗ Branch 1 not taken.
|
102400 | if(!p_igetw(&(tempguy.e_tile),f)) |
| 14022 | { | ||
| 14023 | ✗ | return qe_invalid; | |
| 14024 | } | ||
| 14025 | } | ||
| 14026 | |||
| 14027 |
1/2✓ Branch 0 taken 202752 times.
✗ Branch 1 not taken.
|
202752 | if(!p_getc(&(tempguy.e_width),f)) |
| 14028 | { | ||
| 14029 | ✗ | return qe_invalid; | |
| 14030 | } | ||
| 14031 | |||
| 14032 |
1/2✓ Branch 0 taken 202752 times.
✗ Branch 1 not taken.
|
202752 | if(!p_getc(&(tempguy.e_height),f)) |
| 14033 | { | ||
| 14034 | ✗ | return qe_invalid; | |
| 14035 | } | ||
| 14036 | |||
| 14037 |
1/2✓ Branch 0 taken 202752 times.
✗ Branch 1 not taken.
|
202752 | if(!p_igetw(&(tempguy.hp),f)) |
| 14038 | { | ||
| 14039 | ✗ | return qe_invalid; | |
| 14040 | } | ||
| 14041 | |||
| 14042 |
1/2✓ Branch 0 taken 202752 times.
✗ Branch 1 not taken.
|
202752 | if(!p_igetw(&(tempguy.family),f)) |
| 14043 | { | ||
| 14044 | ✗ | return qe_invalid; | |
| 14045 | } | ||
| 14046 | |||
| 14047 |
1/12✗ Branch 0 not taken.
✓ Branch 1 taken 202752 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
|
202752 | if(guyversion < 9 && (i==eDKNUT1 || i==eDKNUT2 || i==eDKNUT3 || i==eDKNUT4 || i==eDKNUT5)) // Whoops, forgot about Darknuts... |
| 14048 | { | ||
| 14049 | ✗ | if(get_qr(qr_NEWENEMYTILES)) | |
| 14050 | { | ||
| 14051 | ✗ | tempguy.s_tile=tempguy.e_tile+120; | |
| 14052 | ✗ | tempguy.s_width=tempguy.e_width; | |
| 14053 | ✗ | tempguy.s_height=tempguy.e_height; | |
| 14054 | ✗ | } | |
| 14055 | ✗ | else tempguy.s_tile=860; | |
| 14056 | ✗ | } | |
| 14057 | |||
| 14058 |
1/2✓ Branch 0 taken 202752 times.
✗ Branch 1 not taken.
|
202752 | if(!p_igetw(&(tempguy.cset),f)) |
| 14059 | { | ||
| 14060 | ✗ | return qe_invalid; | |
| 14061 | } | ||
| 14062 | |||
| 14063 |
1/2✓ Branch 0 taken 202752 times.
✗ Branch 1 not taken.
|
202752 | if(!p_igetw(&(tempguy.anim),f)) |
| 14064 | { | ||
| 14065 | ✗ | return qe_invalid; | |
| 14066 | } | ||
| 14067 | |||
| 14068 |
1/2✓ Branch 0 taken 202752 times.
✗ Branch 1 not taken.
|
202752 | if(!p_igetw(&(tempguy.e_anim),f)) |
| 14069 | { | ||
| 14070 | ✗ | return qe_invalid; | |
| 14071 | } | ||
| 14072 | |||
| 14073 |
1/2✓ Branch 0 taken 202752 times.
✗ Branch 1 not taken.
|
202752 | if(!p_igetw(&(tempguy.frate),f)) |
| 14074 | { | ||
| 14075 | ✗ | return qe_invalid; | |
| 14076 | } | ||
| 14077 | |||
| 14078 |
1/2✓ Branch 0 taken 202752 times.
✗ Branch 1 not taken.
|
202752 | if(!p_igetw(&(tempguy.e_frate),f)) |
| 14079 | { | ||
| 14080 | ✗ | return qe_invalid; | |
| 14081 | } | ||
| 14082 | |||
| 14083 |
1/2✓ Branch 0 taken 202752 times.
✗ Branch 1 not taken.
|
202752 | if(guyversion < 13) // April 2009 |
| 14084 | { | ||
| 14085 | ✗ | if(get_bit(deprecated_rules, qr_SLOWENEMYANIM_DEP)) | |
| 14086 | { | ||
| 14087 | ✗ | tempguy.frate *= 2; | |
| 14088 | ✗ | tempguy.e_frate *= 2; | |
| 14089 | ✗ | } | |
| 14090 | ✗ | } | |
| 14091 | |||
| 14092 |
1/2✓ Branch 0 taken 202752 times.
✗ Branch 1 not taken.
|
202752 | if(guyversion < 14) // May 1 2009 |
| 14093 | { | ||
| 14094 | ✗ | if(tempguy.anim==a2FRMSLOW) | |
| 14095 | { | ||
| 14096 | ✗ | tempguy.anim=a2FRM; | |
| 14097 | ✗ | tempguy.frate *= 2; | |
| 14098 | ✗ | } | |
| 14099 | |||
| 14100 | ✗ | if(tempguy.e_anim==a2FRMSLOW) | |
| 14101 | { | ||
| 14102 | ✗ | tempguy.e_anim=a2FRM; | |
| 14103 | ✗ | tempguy.e_frate *= 2; | |
| 14104 | ✗ | } | |
| 14105 | |||
| 14106 | ✗ | if(tempguy.anim==aFLIPSLOW) | |
| 14107 | { | ||
| 14108 | ✗ | tempguy.anim=aFLIP; | |
| 14109 | ✗ | tempguy.frate *= 2; | |
| 14110 | ✗ | } | |
| 14111 | |||
| 14112 | ✗ | if(tempguy.e_anim==aFLIPSLOW) | |
| 14113 | { | ||
| 14114 | ✗ | tempguy.e_anim=aFLIP; | |
| 14115 | ✗ | tempguy.e_frate *= 2; | |
| 14116 | ✗ | } | |
| 14117 | |||
| 14118 | ✗ | if(tempguy.anim == aNEWDWALK) tempguy.anim = a4FRM4DIR; | |
| 14119 | |||
| 14120 | ✗ | if(tempguy.e_anim == aNEWDWALK) tempguy.e_anim = a4FRM4DIR; | |
| 14121 | |||
| 14122 | ✗ | if(tempguy.anim == aNEWPOLV || tempguy.anim == a4FRM3TRAP) | |
| 14123 | { | ||
| 14124 | ✗ | tempguy.anim=a4FRM4DIR; | |
| 14125 | ✗ | tempguy.s_tile=(get_qr(qr_NEWENEMYTILES) ? tempguy.e_tile : tempguy.tile)+20; | |
| 14126 | ✗ | } | |
| 14127 | |||
| 14128 | ✗ | if(tempguy.e_anim == aNEWPOLV || tempguy.e_anim == a4FRM3TRAP) | |
| 14129 | { | ||
| 14130 | ✗ | tempguy.e_anim=a4FRM4DIR; | |
| 14131 | ✗ | tempguy.s_tile=(get_qr(qr_NEWENEMYTILES) ? tempguy.e_tile : tempguy.tile)+20; | |
| 14132 | ✗ | } | |
| 14133 | ✗ | } | |
| 14134 | |||
| 14135 |
1/2✓ Branch 0 taken 202752 times.
✗ Branch 1 not taken.
|
202752 | if(!p_igetw(&(tempguy.dp),f)) |
| 14136 | { | ||
| 14137 | ✗ | return qe_invalid; | |
| 14138 | } | ||
| 14139 | |||
| 14140 | //correction for guy fire | ||
| 14141 |
1/2✓ Branch 0 taken 202752 times.
✗ Branch 1 not taken.
|
202752 | if(guyversion < 6) |
| 14142 | { | ||
| 14143 | ✗ | if(i == gFIRE) | |
| 14144 | ✗ | tempguy.dp = 2; | |
| 14145 | ✗ | } | |
| 14146 | |||
| 14147 |
1/2✓ Branch 0 taken 202752 times.
✗ Branch 1 not taken.
|
202752 | if(!p_igetw(&(tempguy.wdp),f)) |
| 14148 | { | ||
| 14149 | ✗ | return qe_invalid; | |
| 14150 | } | ||
| 14151 | |||
| 14152 |
1/2✓ Branch 0 taken 202752 times.
✗ Branch 1 not taken.
|
202752 | if(!p_igetw(&(tempguy.weapon),f)) |
| 14153 | { | ||
| 14154 | ✗ | return qe_invalid; | |
| 14155 | } | ||
| 14156 | |||
| 14157 | //correction for bosses using triple, "rising" fireballs | ||
| 14158 |
1/2✓ Branch 0 taken 202752 times.
✗ Branch 1 not taken.
|
202752 | if(guyversion < 5) |
| 14159 | { | ||
| 14160 | ✗ | if(i == eLAQUAM || i == eRAQUAM || i == eGOHMA1 || i == eGOHMA2 || | |
| 14161 | ✗ | i == eGOHMA3 || i == eGOHMA4) | |
| 14162 | { | ||
| 14163 | ✗ | if(tempguy.weapon == ewFireball) | |
| 14164 | ✗ | tempguy.weapon = ewFireball2; | |
| 14165 | ✗ | } | |
| 14166 | ✗ | } | |
| 14167 | |||
| 14168 |
1/2✓ Branch 0 taken 202752 times.
✗ Branch 1 not taken.
|
202752 | if(!p_igetw(&(tempguy.rate),f)) |
| 14169 | { | ||
| 14170 | ✗ | return qe_invalid; | |
| 14171 | } | ||
| 14172 | |||
| 14173 |
1/2✓ Branch 0 taken 202752 times.
✗ Branch 1 not taken.
|
202752 | if(!p_igetw(&(tempguy.hrate),f)) |
| 14174 | { | ||
| 14175 | ✗ | return qe_invalid; | |
| 14176 | } | ||
| 14177 | |||
| 14178 |
1/2✓ Branch 0 taken 202752 times.
✗ Branch 1 not taken.
|
202752 | if(!p_igetw(&(tempguy.step),f)) |
| 14179 | { | ||
| 14180 | ✗ | return qe_invalid; | |
| 14181 | } | ||
| 14182 | |||
| 14183 | // HIGHLY UNORTHODOX UPDATING THING, part 2 | ||
| 14184 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 202752 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
202752 | if(fixpolsvoice && tempguy.family==eePOLSV) |
| 14185 | { | ||
| 14186 | ✗ | tempguy.step /= 2; | |
| 14187 | ✗ | } | |
| 14188 | |||
| 14189 |
1/2✓ Branch 0 taken 202752 times.
✗ Branch 1 not taken.
|
202752 | if(!p_igetw(&(tempguy.homing),f)) |
| 14190 | { | ||
| 14191 | ✗ | return qe_invalid; | |
| 14192 | } | ||
| 14193 | |||
| 14194 |
1/2✓ Branch 0 taken 202752 times.
✗ Branch 1 not taken.
|
202752 | if(!p_igetw(&(tempguy.grumble),f)) |
| 14195 | { | ||
| 14196 | ✗ | return qe_invalid; | |
| 14197 | } | ||
| 14198 | |||
| 14199 |
1/2✓ Branch 0 taken 202752 times.
✗ Branch 1 not taken.
|
202752 | if(!p_igetw(&(tempguy.item_set),f)) |
| 14200 | { | ||
| 14201 | ✗ | return qe_invalid; | |
| 14202 | } | ||
| 14203 | |||
| 14204 |
1/2✓ Branch 0 taken 202752 times.
✗ Branch 1 not taken.
|
202752 | if(guyversion>=22) // Version 22: Expand misc attributes to 32 bits |
| 14205 | { | ||
| 14206 |
2/2✓ Branch 0 taken 2027520 times.
✓ Branch 1 taken 202752 times.
|
2230272 | for (int q = 0; q < 10; ++q) |
| 14207 | { | ||
| 14208 |
1/2✓ Branch 0 taken 2027520 times.
✗ Branch 1 not taken.
|
2027520 | if (!p_igetl(&(tempguy.attributes[q]), f)) |
| 14209 | { | ||
| 14210 | ✗ | return qe_invalid; | |
| 14211 | } | ||
| 14212 | 2027520 | } | |
| 14213 | 202752 | } | |
| 14214 | else | ||
| 14215 | { | ||
| 14216 | int16_t tempMisc; | ||
| 14217 | |||
| 14218 | ✗ | for(int q=0;q<10;q++) | |
| 14219 | { | ||
| 14220 | ✗ | if (!p_igetw(&tempMisc, f)) | |
| 14221 | { | ||
| 14222 | ✗ | return qe_invalid; | |
| 14223 | } | ||
| 14224 | ✗ | tempguy.attributes[q] = tempMisc; | |
| 14225 | ✗ | } | |
| 14226 | |||
| 14227 | ✗ | if(guyversion < 13) // April 2009 - a tiny Wizzrobe update | |
| 14228 | { | ||
| 14229 | ✗ | if(tempguy.family == eeWIZZ && !(tempguy.attributes[0])) | |
| 14230 | ✗ | tempguy.attributes[4] = 74; | |
| 14231 | ✗ | } | |
| 14232 | |||
| 14233 | } | ||
| 14234 | |||
| 14235 |
1/2✓ Branch 0 taken 202752 times.
✗ Branch 1 not taken.
|
202752 | if(!p_igetw(&(tempguy.bgsfx),f)) |
| 14236 | { | ||
| 14237 | ✗ | return qe_invalid; | |
| 14238 | } | ||
| 14239 | |||
| 14240 |
1/2✓ Branch 0 taken 202752 times.
✗ Branch 1 not taken.
|
202752 | if(!p_igetw(&(tempguy.bosspal),f)) |
| 14241 | { | ||
| 14242 | ✗ | return qe_invalid; | |
| 14243 | } | ||
| 14244 | |||
| 14245 |
1/2✓ Branch 0 taken 202752 times.
✗ Branch 1 not taken.
|
202752 | if(!p_igetw(&(tempguy.extend),f)) |
| 14246 | { | ||
| 14247 | ✗ | return qe_invalid; | |
| 14248 | } | ||
| 14249 | |||
| 14250 | //! Enemy Defences | ||
| 14251 | |||
| 14252 | //If a 2.50 quest, use only the 2.5 defences. | ||
| 14253 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 202752 times.
|
202752 | if(guyversion >= 16 ) // November 2009 - Super Enemy Editor |
| 14254 | { | ||
| 14255 |
2/2✓ Branch 0 taken 3852288 times.
✓ Branch 1 taken 202752 times.
|
4055040 | for(int32_t j=0; j<edefLAST; j++) |
| 14256 | { | ||
| 14257 |
1/2✓ Branch 0 taken 3852288 times.
✗ Branch 1 not taken.
|
3852288 | if(!p_getc(&(tempguy.defense[j]),f)) |
| 14258 | { | ||
| 14259 | ✗ | return qe_invalid; | |
| 14260 | } | ||
| 14261 | 3852288 | } | |
| 14262 | //then copy the generic script defence to all the new script defences | ||
| 14263 | |||
| 14264 | 202752 | } | |
| 14265 | |||
| 14266 | |||
| 14267 | |||
| 14268 | |||
| 14269 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 202752 times.
|
202752 | if(guyversion >= 18) |
| 14270 | { | ||
| 14271 |
1/2✓ Branch 0 taken 202752 times.
✗ Branch 1 not taken.
|
202752 | if(!p_getc(&(tempguy.hitsfx),f)) |
| 14272 | { | ||
| 14273 | ✗ | return qe_invalid; | |
| 14274 | } | ||
| 14275 | |||
| 14276 |
1/2✓ Branch 0 taken 202752 times.
✗ Branch 1 not taken.
|
202752 | if(!p_getc(&(tempguy.deadsfx),f)) |
| 14277 | { | ||
| 14278 | ✗ | return qe_invalid; | |
| 14279 | } | ||
| 14280 | 202752 | } | |
| 14281 | |||
| 14282 |
1/2✓ Branch 0 taken 202752 times.
✗ Branch 1 not taken.
|
202752 | if(guyversion >= 22) |
| 14283 | { | ||
| 14284 |
1/2✓ Branch 0 taken 202752 times.
✗ Branch 1 not taken.
|
202752 | if(!p_igetl(&(tempguy.attributes[10]), f)) |
| 14285 | { | ||
| 14286 | ✗ | return qe_invalid; | |
| 14287 | } | ||
| 14288 | |||
| 14289 |
1/2✓ Branch 0 taken 202752 times.
✗ Branch 1 not taken.
|
202752 | if(!p_igetl(&(tempguy.attributes[11]),f)) |
| 14290 | { | ||
| 14291 | ✗ | return qe_invalid; | |
| 14292 | } | ||
| 14293 | 202752 | } | |
| 14294 | ✗ | else if(guyversion >= 19) | |
| 14295 | { | ||
| 14296 | int16_t tempMisc; | ||
| 14297 | |||
| 14298 | ✗ | if(!p_igetw(&tempMisc,f)) | |
| 14299 | { | ||
| 14300 | ✗ | return qe_invalid; | |
| 14301 | } | ||
| 14302 | |||
| 14303 | ✗ | tempguy.attributes[10] = tempMisc; | |
| 14304 | |||
| 14305 | ✗ | if(!p_igetw(&tempMisc,f)) | |
| 14306 | { | ||
| 14307 | ✗ | return qe_invalid; | |
| 14308 | } | ||
| 14309 | |||
| 14310 | ✗ | tempguy.attributes[11] = tempMisc; | |
| 14311 | ✗ | } | |
| 14312 | |||
| 14313 | //If a 2.54 or later quest, use all of the defences. | ||
| 14314 |
2/2✓ Branch 0 taken 102400 times.
✓ Branch 1 taken 100352 times.
|
202752 | if(guyversion > 24) // Add new guyversion conditional statement |
| 14315 | { | ||
| 14316 |
2/2✓ Branch 0 taken 2207744 times.
✓ Branch 1 taken 100352 times.
|
2308096 | for(int32_t j=edefLAST; j<edefLAST255; j++) |
| 14317 | { | ||
| 14318 |
1/2✓ Branch 0 taken 2207744 times.
✗ Branch 1 not taken.
|
2207744 | if(!p_getc(&(tempguy.defense[j]),f)) |
| 14319 | { | ||
| 14320 | ✗ | return qe_invalid; | |
| 14321 | } | ||
| 14322 | 2207744 | } | |
| 14323 | 100352 | } | |
| 14324 | |||
| 14325 |
2/2✓ Branch 0 taken 100352 times.
✓ Branch 1 taken 102400 times.
|
202752 | if(guyversion <= 24) // Port over generic script settings from old quests in the new editor. |
| 14326 | { | ||
| 14327 |
2/2✓ Branch 0 taken 1024000 times.
✓ Branch 1 taken 102400 times.
|
1126400 | for(int32_t j=edefSCRIPT01; j<=edefSCRIPT10; j++) |
| 14328 | { | ||
| 14329 | 1024000 | tempguy.defense[j] = tempguy.defense[edefSCRIPT] ; | |
| 14330 | 1024000 | } | |
| 14331 | 102400 | } | |
| 14332 | |||
| 14333 | //tilewidth, tileheight, hitwidth, hitheight, hitzheight, hitxofs, hityofs, hitzofs | ||
| 14334 |
2/2✓ Branch 0 taken 102400 times.
✓ Branch 1 taken 100352 times.
|
202752 | if(guyversion > 25) |
| 14335 | { | ||
| 14336 |
1/2✓ Branch 0 taken 100352 times.
✗ Branch 1 not taken.
|
100352 | if(!p_igetl(&(tempguy.txsz),f)) |
| 14337 | { | ||
| 14338 | ✗ | return qe_invalid; | |
| 14339 | } | ||
| 14340 |
1/2✓ Branch 0 taken 100352 times.
✗ Branch 1 not taken.
|
100352 | if(!p_igetl(&(tempguy.tysz),f)) |
| 14341 | { | ||
| 14342 | ✗ | return qe_invalid; | |
| 14343 | } | ||
| 14344 |
1/2✓ Branch 0 taken 100352 times.
✗ Branch 1 not taken.
|
100352 | if(!p_igetl(&(tempguy.hxsz),f)) |
| 14345 | { | ||
| 14346 | ✗ | return qe_invalid; | |
| 14347 | } | ||
| 14348 |
1/2✓ Branch 0 taken 100352 times.
✗ Branch 1 not taken.
|
100352 | if(!p_igetl(&(tempguy.hysz),f)) |
| 14349 | { | ||
| 14350 | ✗ | return qe_invalid; | |
| 14351 | } | ||
| 14352 |
1/2✓ Branch 0 taken 100352 times.
✗ Branch 1 not taken.
|
100352 | if(!p_igetl(&(tempguy.hzsz),f)) |
| 14353 | { | ||
| 14354 | ✗ | return qe_invalid; | |
| 14355 | } | ||
| 14356 | /* Is it safe to read a fixed with getl, or do I need to typecast it? -Z | ||
| 14357 | |||
| 14358 | */ | ||
| 14359 | 100352 | } | |
| 14360 | //More Enemy Editor vars for 2.60 | ||
| 14361 |
2/2✓ Branch 0 taken 102400 times.
✓ Branch 1 taken 100352 times.
|
202752 | if(guyversion > 26) |
| 14362 | { | ||
| 14363 |
1/2✓ Branch 0 taken 100352 times.
✗ Branch 1 not taken.
|
100352 | if(!p_igetl(&(tempguy.hxofs),f)) |
| 14364 | { | ||
| 14365 | ✗ | return qe_invalid; | |
| 14366 | } | ||
| 14367 |
1/2✓ Branch 0 taken 100352 times.
✗ Branch 1 not taken.
|
100352 | if(!p_igetl(&(tempguy.hyofs),f)) |
| 14368 | { | ||
| 14369 | ✗ | return qe_invalid; | |
| 14370 | } | ||
| 14371 |
1/2✓ Branch 0 taken 100352 times.
✗ Branch 1 not taken.
|
100352 | if(!p_igetl(&(tempguy.xofs),f)) |
| 14372 | { | ||
| 14373 | ✗ | return qe_invalid; | |
| 14374 | } | ||
| 14375 |
1/2✓ Branch 0 taken 100352 times.
✗ Branch 1 not taken.
|
100352 | if(!p_igetl(&(tempguy.yofs),f)) |
| 14376 | { | ||
| 14377 | ✗ | return qe_invalid; | |
| 14378 | } | ||
| 14379 |
1/2✓ Branch 0 taken 100352 times.
✗ Branch 1 not taken.
|
100352 | if(!p_igetl(&(tempguy.zofs),f)) |
| 14380 | { | ||
| 14381 | ✗ | return qe_invalid; | |
| 14382 | } | ||
| 14383 | 100352 | } | |
| 14384 | |||
| 14385 |
2/2✓ Branch 0 taken 100352 times.
✓ Branch 1 taken 102400 times.
|
202752 | if(guyversion <= 27) // Port over generic script settings from old quests in the new editor. |
| 14386 | { | ||
| 14387 | 102400 | tempguy.wpnsprite = 0; | |
| 14388 | 102400 | } | |
| 14389 | |||
| 14390 |
2/2✓ Branch 0 taken 102400 times.
✓ Branch 1 taken 100352 times.
|
202752 | if(guyversion > 27) |
| 14391 | { | ||
| 14392 |
1/2✓ Branch 0 taken 100352 times.
✗ Branch 1 not taken.
|
100352 | if(!p_igetl(&(tempguy.wpnsprite),f)) |
| 14393 | { | ||
| 14394 | ✗ | return qe_invalid; | |
| 14395 | } | ||
| 14396 | 100352 | } | |
| 14397 |
2/2✓ Branch 0 taken 100352 times.
✓ Branch 1 taken 102400 times.
|
202752 | if(guyversion <= 28) // Port over generic script settings from old quests in the new editor. |
| 14398 | { | ||
| 14399 | 102400 | tempguy.SIZEflags = 0; | |
| 14400 | 102400 | } | |
| 14401 |
2/2✓ Branch 0 taken 102400 times.
✓ Branch 1 taken 100352 times.
|
202752 | if(guyversion > 28) |
| 14402 | { | ||
| 14403 |
1/2✓ Branch 0 taken 100352 times.
✗ Branch 1 not taken.
|
100352 | if(!p_igetl(&(tempguy.SIZEflags),f)) |
| 14404 | { | ||
| 14405 | ✗ | return qe_invalid; | |
| 14406 | } | ||
| 14407 | |||
| 14408 | 100352 | } | |
| 14409 |
2/2✓ Branch 0 taken 100352 times.
✓ Branch 1 taken 102400 times.
|
202752 | if(guyversion < 30) // Port over generic script settings from old quests in the new editor. |
| 14410 | { | ||
| 14411 | 102400 | tempguy.frozentile = 0; | |
| 14412 | 102400 | tempguy.frozencset = 0; | |
| 14413 | 102400 | tempguy.frozenclock = 0; | |
| 14414 |
2/2✓ Branch 0 taken 1024000 times.
✓ Branch 1 taken 102400 times.
|
1126400 | for ( int32_t q = 0; q < 10; q++ ) tempguy.frozenmisc[q] = 0; |
| 14415 | 102400 | } | |
| 14416 |
2/2✓ Branch 0 taken 102400 times.
✓ Branch 1 taken 100352 times.
|
202752 | if(guyversion >= 30) |
| 14417 | { | ||
| 14418 |
1/2✓ Branch 0 taken 100352 times.
✗ Branch 1 not taken.
|
100352 | if(!p_igetl(&(tempguy.frozentile),f)) |
| 14419 | { | ||
| 14420 | ✗ | return qe_invalid; | |
| 14421 | } | ||
| 14422 |
1/2✓ Branch 0 taken 100352 times.
✗ Branch 1 not taken.
|
100352 | if(!p_igetl(&(tempguy.frozencset),f)) |
| 14423 | { | ||
| 14424 | ✗ | return qe_invalid; | |
| 14425 | } | ||
| 14426 |
1/2✓ Branch 0 taken 100352 times.
✗ Branch 1 not taken.
|
100352 | if(!p_igetl(&(tempguy.frozenclock),f)) |
| 14427 | { | ||
| 14428 | ✗ | return qe_invalid; | |
| 14429 | } | ||
| 14430 |
2/2✓ Branch 0 taken 1003520 times.
✓ Branch 1 taken 100352 times.
|
1103872 | for ( int32_t q = 0; q < 10; q++ ) { |
| 14431 |
1/2✓ Branch 0 taken 1003520 times.
✗ Branch 1 not taken.
|
1003520 | if(!p_igetw(&(tempguy.frozenmisc[q]),f)) |
| 14432 | { | ||
| 14433 | ✗ | return qe_invalid; | |
| 14434 | } | ||
| 14435 | 1003520 | } | |
| 14436 | |||
| 14437 | 100352 | } | |
| 14438 | |||
| 14439 |
2/2✓ Branch 0 taken 102400 times.
✓ Branch 1 taken 100352 times.
|
202752 | if(guyversion >= 34) |
| 14440 | { | ||
| 14441 |
1/2✓ Branch 0 taken 100352 times.
✗ Branch 1 not taken.
|
100352 | if(!p_igetw(&(tempguy.firesfx),f)) |
| 14442 | { | ||
| 14443 | ✗ | return qe_invalid; | |
| 14444 | } | ||
| 14445 |
2/2✓ Branch 0 taken 1705984 times.
✓ Branch 1 taken 100352 times.
|
1806336 | for(int q=15;q<32;++q) |
| 14446 | { | ||
| 14447 |
1/2✓ Branch 0 taken 1705984 times.
✗ Branch 1 not taken.
|
1705984 | if(!p_igetl(&(tempguy.attributes[q]),f)) |
| 14448 | { | ||
| 14449 | ✗ | return qe_invalid; | |
| 14450 | } | ||
| 14451 | 1705984 | } | |
| 14452 | |||
| 14453 |
2/2✓ Branch 0 taken 3211264 times.
✓ Branch 1 taken 100352 times.
|
3311616 | for ( int32_t q = 0; q < 32; q++ ) { |
| 14454 |
1/2✓ Branch 0 taken 3211264 times.
✗ Branch 1 not taken.
|
3211264 | if(!p_igetl(&(tempguy.movement[q]),f)) |
| 14455 | { | ||
| 14456 | ✗ | return qe_invalid; | |
| 14457 | } | ||
| 14458 | 3211264 | } | |
| 14459 |
2/2✓ Branch 0 taken 3211264 times.
✓ Branch 1 taken 100352 times.
|
3311616 | for ( int32_t q = 0; q < 32; q++ ) { |
| 14460 |
1/2✓ Branch 0 taken 3211264 times.
✗ Branch 1 not taken.
|
3211264 | if(!p_igetl(&(tempguy.new_weapon[q]),f)) |
| 14461 | { | ||
| 14462 | ✗ | return qe_invalid; | |
| 14463 | } | ||
| 14464 | 3211264 | } | |
| 14465 |
1/2✓ Branch 0 taken 100352 times.
✗ Branch 1 not taken.
|
100352 | if(!p_igetw(&(tempguy.script),f)) |
| 14466 | { | ||
| 14467 | ✗ | return qe_invalid; | |
| 14468 | } | ||
| 14469 |
2/2✓ Branch 0 taken 802816 times.
✓ Branch 1 taken 100352 times.
|
903168 | for ( int32_t q = 0; q < 8; q++ ) |
| 14470 | { | ||
| 14471 |
1/2✓ Branch 0 taken 802816 times.
✗ Branch 1 not taken.
|
802816 | if(!p_igetl(&(tempguy.initD[q]),f)) |
| 14472 | { | ||
| 14473 | ✗ | return qe_invalid; | |
| 14474 | } | ||
| 14475 | 802816 | } | |
| 14476 |
2/2✓ Branch 0 taken 200704 times.
✓ Branch 1 taken 100352 times.
|
301056 | for ( int32_t q = 0; q < 2; q++ ) |
| 14477 | { | ||
| 14478 | int32_t temp; | ||
| 14479 |
1/2✓ Branch 0 taken 200704 times.
✗ Branch 1 not taken.
|
200704 | if(!p_igetl(&temp,f)) |
| 14480 | { | ||
| 14481 | ✗ | return qe_invalid; | |
| 14482 | } | ||
| 14483 | 200704 | } | |
| 14484 | |||
| 14485 | 100352 | } | |
| 14486 | |||
| 14487 |
2/2✓ Branch 0 taken 102400 times.
✓ Branch 1 taken 100352 times.
|
202752 | if(guyversion >= 37) |
| 14488 | { | ||
| 14489 |
1/2✓ Branch 0 taken 100352 times.
✗ Branch 1 not taken.
|
100352 | if(!p_igetl(&(tempguy.editorflags),f)) |
| 14490 | { | ||
| 14491 | ✗ | return qe_invalid; | |
| 14492 | } | ||
| 14493 | 100352 | } | |
| 14494 |
2/2✓ Branch 0 taken 100352 times.
✓ Branch 1 taken 102400 times.
|
202752 | if ( guyversion < 37 ) { tempguy.editorflags = 0; } |
| 14495 |
2/2✓ Branch 0 taken 102400 times.
✓ Branch 1 taken 100352 times.
|
202752 | if(guyversion >= 38) |
| 14496 | { | ||
| 14497 |
1/2✓ Branch 0 taken 100352 times.
✗ Branch 1 not taken.
|
100352 | if(!p_igetl(&(tempguy.attributes[12]),f)) |
| 14498 | { | ||
| 14499 | ✗ | return qe_invalid; | |
| 14500 | } | ||
| 14501 |
1/2✓ Branch 0 taken 100352 times.
✗ Branch 1 not taken.
|
100352 | if(!p_igetl(&(tempguy.attributes[13]),f)) |
| 14502 | { | ||
| 14503 | ✗ | return qe_invalid; | |
| 14504 | } | ||
| 14505 |
1/2✓ Branch 0 taken 100352 times.
✗ Branch 1 not taken.
|
100352 | if(!p_igetl(&(tempguy.attributes[14]),f)) |
| 14506 | { | ||
| 14507 | ✗ | return qe_invalid; | |
| 14508 | } | ||
| 14509 | |||
| 14510 | 100352 | } | |
| 14511 |
2/2✓ Branch 0 taken 100352 times.
✓ Branch 1 taken 102400 times.
|
202752 | if ( guyversion < 38 ) |
| 14512 | { | ||
| 14513 | 102400 | tempguy.attributes[12] = 0; | |
| 14514 | 102400 | tempguy.attributes[13] = 0; | |
| 14515 | 102400 | tempguy.attributes[14] = 0; | |
| 14516 | 102400 | } | |
| 14517 | |||
| 14518 |
2/2✓ Branch 0 taken 102400 times.
✓ Branch 1 taken 100352 times.
|
202752 | if ( guyversion >= 39 ) |
| 14519 | { | ||
| 14520 |
2/2✓ Branch 0 taken 802816 times.
✓ Branch 1 taken 100352 times.
|
903168 | for ( int32_t q = 0; q < 8; q++ ) |
| 14521 | { | ||
| 14522 |
2/2✓ Branch 0 taken 52183040 times.
✓ Branch 1 taken 802816 times.
|
52985856 | for ( int32_t w = 0; w < 65; w++ ) |
| 14523 | { | ||
| 14524 |
1/2✓ Branch 0 taken 52183040 times.
✗ Branch 1 not taken.
|
52183040 | if(!p_getc(&(tempguy.initD_label[q][w]),f)) |
| 14525 | { | ||
| 14526 | ✗ | return qe_invalid; | |
| 14527 | } | ||
| 14528 | 52183040 | } | |
| 14529 |
2/2✓ Branch 0 taken 520192 times.
✓ Branch 1 taken 282624 times.
|
802816 | if(guyversion < 54) |
| 14530 | { | ||
| 14531 | byte dummybyte; | ||
| 14532 |
2/2✓ Branch 0 taken 18370560 times.
✓ Branch 1 taken 282624 times.
|
18653184 | for ( int32_t w = 0; w < 65; w++ ) |
| 14533 |
1/2✓ Branch 0 taken 18370560 times.
✗ Branch 1 not taken.
|
18370560 | if(!p_getc(&dummybyte,f)) |
| 14534 | ✗ | return qe_invalid; | |
| 14535 | 282624 | } | |
| 14536 | 802816 | } | |
| 14537 | |||
| 14538 | |||
| 14539 | 100352 | } | |
| 14540 |
2/2✓ Branch 0 taken 100352 times.
✓ Branch 1 taken 102400 times.
|
202752 | if ( guyversion < 39 ) //apply old InitD strings to both |
| 14541 | { | ||
| 14542 |
2/2✓ Branch 0 taken 819200 times.
✓ Branch 1 taken 102400 times.
|
921600 | for ( int32_t q = 0; q < 8; q++ ) |
| 14543 | { | ||
| 14544 | 819200 | sprintf(tempguy.initD_label[q],"InitD[%d]",q); | |
| 14545 | 819200 | } | |
| 14546 | 102400 | } | |
| 14547 |
4/4✓ Branch 0 taken 100352 times.
✓ Branch 1 taken 102400 times.
✓ Branch 2 taken 65024 times.
✓ Branch 3 taken 35328 times.
|
202752 | if ( guyversion >= 40 && guyversion < 54) |
| 14548 |
1/2✓ Branch 0 taken 35328 times.
✗ Branch 1 not taken.
|
35328 | if(!p_igetw(&(tempguy.weap_data.script),f)) |
| 14549 | ✗ | return qe_invalid; | |
| 14550 |
2/2✓ Branch 0 taken 100352 times.
✓ Branch 1 taken 102400 times.
|
202752 | if ( guyversion < 40 ) |
| 14551 | 102400 | tempguy.weap_data.script = 0; | |
| 14552 | //eweapon script InitD | ||
| 14553 |
2/2✓ Branch 0 taken 102400 times.
✓ Branch 1 taken 100352 times.
|
202752 | if ( guyversion >= 41 ) |
| 14554 | { | ||
| 14555 |
2/2✓ Branch 0 taken 65024 times.
✓ Branch 1 taken 35328 times.
|
100352 | if(guyversion < 54) |
| 14556 |
2/2✓ Branch 0 taken 282624 times.
✓ Branch 1 taken 35328 times.
|
317952 | for ( int32_t q = 0; q < 8; q++ ) |
| 14557 |
1/2✓ Branch 0 taken 282624 times.
✗ Branch 1 not taken.
|
282624 | if(!p_igetl(&(tempguy.weap_data.initd[q]),f)) |
| 14558 | 35328 | return qe_invalid; | |
| 14559 |
1/2✓ Branch 0 taken 100352 times.
✗ Branch 1 not taken.
|
100352 | if ( guy_cversion < 4 ) |
| 14560 | { | ||
| 14561 | ✗ | if ( tempguy.family == eeKEESE ) | |
| 14562 | { | ||
| 14563 | |||
| 14564 | ✗ | if ( !tempguy.attributes[0] ) | |
| 14565 | { | ||
| 14566 | ✗ | tempguy.attributes[15] = 120; | |
| 14567 | ✗ | tempguy.attributes[16] = 16; | |
| 14568 | |||
| 14569 | ✗ | } | |
| 14570 | ✗ | } | |
| 14571 | ✗ | if ( tempguy.family == eePEAHAT ) | |
| 14572 | { | ||
| 14573 | ✗ | tempguy.attributes[15] = 80; | |
| 14574 | ✗ | tempguy.attributes[16] = 16; | |
| 14575 | ✗ | } | |
| 14576 | |||
| 14577 | ✗ | if ( tempguy.family == eeGHINI ) | |
| 14578 | { | ||
| 14579 | ✗ | tempguy.attributes[15] = 120; | |
| 14580 | ✗ | tempguy.attributes[16] = 10; | |
| 14581 | ✗ | } | |
| 14582 | |||
| 14583 | ✗ | } | |
| 14584 | 100352 | } | |
| 14585 | |||
| 14586 | |||
| 14587 | |||
| 14588 | //default weapon sprites (quest version < 2.54) | ||
| 14589 | //port over old defaults -Z | ||
| 14590 |
2/2✓ Branch 0 taken 100352 times.
✓ Branch 1 taken 102400 times.
|
202752 | if(guyversion < 32) |
| 14591 | { | ||
| 14592 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 102400 times.
|
102400 | if ( tempguy.wpnsprite <= 0 ) |
| 14593 | { | ||
| 14594 |
16/20✗ Branch 0 not taken.
✓ Branch 1 taken 2849 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 86878 times.
✓ Branch 4 taken 801 times.
✓ Branch 5 taken 691 times.
✓ Branch 6 taken 1900 times.
✓ Branch 7 taken 1291 times.
✓ Branch 8 taken 2399 times.
✓ Branch 9 taken 206 times.
✓ Branch 10 taken 77 times.
✓ Branch 11 taken 448 times.
✓ Branch 12 taken 79 times.
✓ Branch 13 taken 906 times.
✓ Branch 14 taken 1802 times.
✓ Branch 15 taken 229 times.
✓ Branch 16 taken 325 times.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✓ Branch 19 taken 1519 times.
|
102400 | switch(tempguy.weapon) |
| 14595 | { | ||
| 14596 | case wNone: | ||
| 14597 | 86878 | tempguy.wpnsprite = 0; break; | |
| 14598 | |||
| 14599 | case wSword: | ||
| 14600 | case wBeam: | ||
| 14601 | case wBrang: | ||
| 14602 | case wBomb: | ||
| 14603 | case wSBomb: | ||
| 14604 | case wLitBomb: | ||
| 14605 | case wLitSBomb: | ||
| 14606 | case wArrow: | ||
| 14607 | case wFire: | ||
| 14608 | case wWhistle: | ||
| 14609 | case wBait: | ||
| 14610 | case wWand: | ||
| 14611 | case wMagic: | ||
| 14612 | case wCatching: | ||
| 14613 | case wWind: | ||
| 14614 | case wRefMagic: | ||
| 14615 | case wRefFireball: | ||
| 14616 | case wRefRock: | ||
| 14617 | case wHammer: | ||
| 14618 | case wHookshot: | ||
| 14619 | case wHSHandle: | ||
| 14620 | case wHSChain: | ||
| 14621 | case wSSparkle: | ||
| 14622 | case wFSparkle: | ||
| 14623 | case wSmack: | ||
| 14624 | case wPhantom: | ||
| 14625 | case wCByrna: | ||
| 14626 | case wRefBeam: | ||
| 14627 | case wStomp: | ||
| 14628 | case lwMax: | ||
| 14629 | case wScript1: | ||
| 14630 | case wScript2: | ||
| 14631 | case wScript3: | ||
| 14632 | case wScript4: | ||
| 14633 | case wScript5: | ||
| 14634 | case wScript6: | ||
| 14635 | case wScript7: | ||
| 14636 | case wScript8: | ||
| 14637 | case wScript9: | ||
| 14638 | case wScript10: | ||
| 14639 | case wIce: | ||
| 14640 | //Cannot use any of these weapons yet. | ||
| 14641 | ✗ | tempguy.wpnsprite = -1; | |
| 14642 | ✗ | break; | |
| 14643 | |||
| 14644 | case wEnemyWeapons: | ||
| 14645 | 2849 | case ewFireball: tempguy.wpnsprite = 17; break; | |
| 14646 | |||
| 14647 | 801 | case ewArrow: tempguy.wpnsprite = 19; break; | |
| 14648 | 691 | case ewBrang: tempguy.wpnsprite = 4; break; | |
| 14649 | 1900 | case ewSword: tempguy.wpnsprite = 20; break; | |
| 14650 | 1291 | case ewRock: tempguy.wpnsprite = 18; break; | |
| 14651 | 2399 | case ewMagic: tempguy.wpnsprite = 21; break; | |
| 14652 | 206 | case ewBomb: tempguy.wpnsprite = 78; break; | |
| 14653 | 77 | case ewSBomb: tempguy.wpnsprite = 79; break; | |
| 14654 | 448 | case ewLitBomb: tempguy.wpnsprite = 76; break; | |
| 14655 | 79 | case ewLitSBomb: tempguy.wpnsprite = 77; break; | |
| 14656 | 906 | case ewFireTrail: tempguy.wpnsprite = 80; break; | |
| 14657 | 1802 | case ewFlame: tempguy.wpnsprite = 35; break; | |
| 14658 | 229 | case ewWind: tempguy.wpnsprite = 36; break; | |
| 14659 | 325 | case ewFlame2: tempguy.wpnsprite = 81; break; | |
| 14660 | ✗ | case ewFlame2Trail: tempguy.wpnsprite = 82; break; | |
| 14661 | ✗ | case ewIce: tempguy.wpnsprite = 83; break; | |
| 14662 | 1519 | case ewFireball2: tempguy.wpnsprite = 17; break; //fireball (rising) | |
| 14663 | |||
| 14664 | |||
| 14665 | ✗ | default: break; //No assign. | |
| 14666 | } | ||
| 14667 | 102400 | } | |
| 14668 | 102400 | } | |
| 14669 | |||
| 14670 | //default weapon fire sound (quest version < 2.54) | ||
| 14671 | //port over old defaults and zero new data. -Z | ||
| 14672 |
2/2✓ Branch 0 taken 100352 times.
✓ Branch 1 taken 102400 times.
|
202752 | if(guyversion < 34) |
| 14673 | { | ||
| 14674 |
2/2✓ Branch 0 taken 3276800 times.
✓ Branch 1 taken 102400 times.
|
3379200 | for ( int32_t q = 0; q < 32; q++ ) |
| 14675 | { | ||
| 14676 | 3276800 | tempguy.movement[q] = 0; | |
| 14677 | 3276800 | tempguy.new_weapon[q] = 0; | |
| 14678 | |||
| 14679 | 3276800 | } | |
| 14680 | |||
| 14681 | //NPC Script attributes. | ||
| 14682 | 102400 | tempguy.script = 0; //No scripted enemies existed. -Z | |
| 14683 |
2/2✓ Branch 0 taken 819200 times.
✓ Branch 1 taken 102400 times.
|
921600 | for ( int32_t q = 0; q < 8; q++ ) tempguy.initD[q] = 0; //Script Data |
| 14684 | |||
| 14685 |
2/2✓ Branch 0 taken 1740800 times.
✓ Branch 1 taken 102400 times.
|
1843200 | for ( int32_t q = 15; q < 32; q++) tempguy.attributes[q] = 0; //misc 16-32 |
| 14686 | |||
| 14687 | //old default sounds | ||
| 14688 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 102400 times.
|
102400 | if ( tempguy.firesfx <= 0 ) |
| 14689 | { | ||
| 14690 |
16/20✗ Branch 0 not taken.
✓ Branch 1 taken 2849 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 86878 times.
✓ Branch 4 taken 801 times.
✓ Branch 5 taken 691 times.
✓ Branch 6 taken 1900 times.
✓ Branch 7 taken 1291 times.
✓ Branch 8 taken 2399 times.
✓ Branch 9 taken 206 times.
✓ Branch 10 taken 77 times.
✓ Branch 11 taken 448 times.
✓ Branch 12 taken 79 times.
✓ Branch 13 taken 906 times.
✓ Branch 14 taken 1802 times.
✓ Branch 15 taken 229 times.
✓ Branch 16 taken 325 times.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✓ Branch 19 taken 1519 times.
|
102400 | switch(tempguy.weapon) |
| 14691 | { | ||
| 14692 | case wNone: | ||
| 14693 | 86878 | tempguy.firesfx = 0; break; | |
| 14694 | |||
| 14695 | case wSword: | ||
| 14696 | case wBeam: | ||
| 14697 | case wBrang: | ||
| 14698 | case wBomb: | ||
| 14699 | case wSBomb: | ||
| 14700 | case wLitBomb: | ||
| 14701 | case wLitSBomb: | ||
| 14702 | case wArrow: | ||
| 14703 | case wFire: | ||
| 14704 | case wWhistle: | ||
| 14705 | case wBait: | ||
| 14706 | case wWand: | ||
| 14707 | case wMagic: | ||
| 14708 | case wCatching: | ||
| 14709 | case wWind: | ||
| 14710 | case wRefMagic: | ||
| 14711 | case wRefFireball: | ||
| 14712 | case wRefRock: | ||
| 14713 | case wHammer: | ||
| 14714 | case wHookshot: | ||
| 14715 | case wHSHandle: | ||
| 14716 | case wHSChain: | ||
| 14717 | case wSSparkle: | ||
| 14718 | case wFSparkle: | ||
| 14719 | case wSmack: | ||
| 14720 | case wPhantom: | ||
| 14721 | case wCByrna: | ||
| 14722 | case wRefBeam: | ||
| 14723 | case wStomp: | ||
| 14724 | case lwMax: | ||
| 14725 | case wScript1: | ||
| 14726 | case wScript2: | ||
| 14727 | case wScript3: | ||
| 14728 | case wScript4: | ||
| 14729 | case wScript5: | ||
| 14730 | case wScript6: | ||
| 14731 | case wScript7: | ||
| 14732 | case wScript8: | ||
| 14733 | case wScript9: | ||
| 14734 | case wScript10: | ||
| 14735 | case wIce: | ||
| 14736 | //Cannot use any of these weapons yet. | ||
| 14737 | ✗ | tempguy.firesfx = -1; | |
| 14738 | ✗ | break; | |
| 14739 | |||
| 14740 | case wEnemyWeapons: | ||
| 14741 | 2849 | case ewFireball: tempguy.firesfx = 40; break; | |
| 14742 | |||
| 14743 | 801 | case ewArrow: tempguy.firesfx = 1; break; //Ghost.zh has 0? | |
| 14744 | 691 | case ewBrang: tempguy.firesfx = 4; break; //Ghost.zh has 0? | |
| 14745 | 1900 | case ewSword: tempguy.firesfx = 20; break; //Ghost.zh has 0? | |
| 14746 | 1291 | case ewRock: tempguy.firesfx = 51; break; | |
| 14747 | 2399 | case ewMagic: tempguy.firesfx = 32; break; | |
| 14748 | 206 | case ewBomb: tempguy.firesfx = 3; break; //Ghost.zh has 0? | |
| 14749 | 77 | case ewSBomb: tempguy.firesfx = 3; break; //Ghost.zh has 0? | |
| 14750 | 448 | case ewLitBomb: tempguy.firesfx = 21; break; //Ghost.zh has 0? | |
| 14751 | 79 | case ewLitSBomb: tempguy.firesfx = 21; break; //Ghost.zh has 0? | |
| 14752 | 906 | case ewFireTrail: tempguy.firesfx = 13; break; | |
| 14753 | 1802 | case ewFlame: tempguy.firesfx = 13; break; | |
| 14754 | 229 | case ewWind: tempguy.firesfx = 32; break; | |
| 14755 | 325 | case ewFlame2: tempguy.firesfx = 13; break; | |
| 14756 | ✗ | case ewFlame2Trail: tempguy.firesfx = 13; break; | |
| 14757 | ✗ | case ewIce: tempguy.firesfx = 44; break; | |
| 14758 | 1519 | case ewFireball2: tempguy.firesfx = 40; break; //fireball (rising) | |
| 14759 | |||
| 14760 | //what about special attacks (e.g. summoning == 56) | ||
| 14761 | ✗ | default: break; //No assign. | |
| 14762 | } | ||
| 14763 | 102400 | } | |
| 14764 | 102400 | } | |
| 14765 | |||
| 14766 | //Port hardcoded hit sound to the enemy hitsfx defaults for older quests. | ||
| 14767 |
4/6✓ Branch 0 taken 100352 times.
✓ Branch 1 taken 102400 times.
✓ Branch 2 taken 100352 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 100352 times.
|
202752 | if(Header->zelda_version <= 0x250 || ( Header->zelda_version > 0x250 && guyversion < 35 )) |
| 14768 | { | ||
| 14769 |
2/2✓ Branch 0 taken 89799 times.
✓ Branch 1 taken 12601 times.
|
102400 | if ( tempguy.hitsfx == 0 ) tempguy.hitsfx = 11; |
| 14770 | 102400 | } | |
| 14771 | //Keese and bat halt rates. | ||
| 14772 |
3/4✓ Branch 0 taken 102400 times.
✓ Branch 1 taken 100352 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 102400 times.
|
202752 | if ( guyversion < 42 && guy_cversion < 4 ) |
| 14773 | { | ||
| 14774 | |||
| 14775 |
2/2✓ Branch 0 taken 101101 times.
✓ Branch 1 taken 1299 times.
|
102400 | if ( tempguy.family == eeKEESE ) |
| 14776 | { | ||
| 14777 | |||
| 14778 |
2/2✓ Branch 0 taken 935 times.
✓ Branch 1 taken 364 times.
|
1299 | if ( !tempguy.attributes[0] ) |
| 14779 | { | ||
| 14780 | 935 | tempguy.attributes[15] = 120; | |
| 14781 | 935 | tempguy.attributes[16] = 16; | |
| 14782 | |||
| 14783 | 935 | } | |
| 14784 | 1299 | } | |
| 14785 |
2/2✓ Branch 0 taken 101935 times.
✓ Branch 1 taken 465 times.
|
102400 | if ( tempguy.family == eePEAHAT ) |
| 14786 | { | ||
| 14787 | 465 | tempguy.attributes[15] = 80; | |
| 14788 | 465 | tempguy.attributes[16] = 16; | |
| 14789 | 465 | } | |
| 14790 |
2/2✓ Branch 0 taken 102200 times.
✓ Branch 1 taken 200 times.
|
102400 | if ( tempguy.family == eeGHINI ) |
| 14791 | { | ||
| 14792 | 200 | tempguy.attributes[15] = 120; | |
| 14793 | 200 | tempguy.attributes[16] = 10; | |
| 14794 | 200 | } | |
| 14795 | |||
| 14796 | |||
| 14797 | 102400 | } | |
| 14798 | |||
| 14799 | |||
| 14800 | //miscellaneous other corrections | ||
| 14801 | //fix the mirror wizzrobe -DD | ||
| 14802 |
1/2✓ Branch 0 taken 202752 times.
✗ Branch 1 not taken.
|
202752 | if(guyversion < 7) |
| 14803 | { | ||
| 14804 | ✗ | if(i == eMWIZ) | |
| 14805 | { | ||
| 14806 | ✗ | tempguy.attributes[1] = 0; | |
| 14807 | ✗ | tempguy.attributes[3] = 1; | |
| 14808 | ✗ | } | |
| 14809 | ✗ | } | |
| 14810 | |||
| 14811 |
1/2✓ Branch 0 taken 202752 times.
✗ Branch 1 not taken.
|
202752 | if(guyversion < 8) |
| 14812 | { | ||
| 14813 | ✗ | if(i == eGLEEOK1 || i == eGLEEOK2 || i == eGLEEOK3 || i == eGLEEOK4 || i == eGLEEOK1F || i == eGLEEOK2F || i == eGLEEOK3F || i == eGLEEOK4F) | |
| 14814 | { | ||
| 14815 | // Some of these are deliberately different to NewDefault/defdata.cpp, by the way. -L | ||
| 14816 | ✗ | tempguy.attributes[4] = 4; //neck length in segments | |
| 14817 | ✗ | tempguy.attributes[5] = 8; //neck offset from first body tile | |
| 14818 | ✗ | tempguy.attributes[6] = 40; //offset for each subsequent neck tile from the first neck tile | |
| 14819 | ✗ | tempguy.attributes[7] = 168; //head offset from first body tile | |
| 14820 | ✗ | tempguy.attributes[8] = 228; //flying head offset from first body tile | |
| 14821 | |||
| 14822 | ✗ | if(i == eGLEEOK1F || i == eGLEEOK2F || i == eGLEEOK3F || i == eGLEEOK4F) | |
| 14823 | { | ||
| 14824 | ✗ | tempguy.attributes[5] += 10; //neck offset from first body tile | |
| 14825 | ✗ | tempguy.attributes[7] -= 12; //head offset from first body tile | |
| 14826 | ✗ | } | |
| 14827 | ✗ | } | |
| 14828 | ✗ | } | |
| 14829 | |||
| 14830 |
1/2✓ Branch 0 taken 202752 times.
✗ Branch 1 not taken.
|
202752 | if(guyversion < 10) // December 2007 - Dodongo CSet fix |
| 14831 | { | ||
| 14832 | ✗ | if(get_bit(deprecated_rules,46) && tempguy.family==eeDONGO && tempguy.attributes[0]==0) | |
| 14833 | ✗ | tempguy.bosspal = spDIG; | |
| 14834 | ✗ | } | |
| 14835 | |||
| 14836 |
1/2✓ Branch 0 taken 202752 times.
✗ Branch 1 not taken.
|
202752 | if(guyversion < 11) // December 2007 - Spinning Tile fix |
| 14837 | { | ||
| 14838 | ✗ | if(tempguy.family==eeSPINTILE) | |
| 14839 | { | ||
| 14840 | ✗ | tempguy.flags |= guy_superman; | |
| 14841 | ✗ | tempguy.item_set = 0; // Don't drop items | |
| 14842 | ✗ | tempguy.step = 300; | |
| 14843 | ✗ | } | |
| 14844 | ✗ | } | |
| 14845 | |||
| 14846 |
1/2✓ Branch 0 taken 202752 times.
✗ Branch 1 not taken.
|
202752 | if(guyversion < 12) // October 2008 - Flashing Bubble, Rope 2, and Ghini 2 fix |
| 14847 | { | ||
| 14848 | ✗ | if(get_bit(deprecated_rules, qr_NOROPE2FLASH_DEP)) | |
| 14849 | { | ||
| 14850 | ✗ | if(tempguy.family==eeROPE) | |
| 14851 | { | ||
| 14852 | ✗ | tempguy.flags &= ~guy_flashing; | |
| 14853 | ✗ | } | |
| 14854 | ✗ | } | |
| 14855 | |||
| 14856 | ✗ | if(get_bit(deprecated_rules, qr_NOBUBBLEFLASH_DEP)) | |
| 14857 | { | ||
| 14858 | ✗ | if(tempguy.family==eeBUBBLE) | |
| 14859 | { | ||
| 14860 | ✗ | tempguy.flags &= ~guy_flashing; | |
| 14861 | ✗ | } | |
| 14862 | ✗ | } | |
| 14863 | |||
| 14864 | ✗ | if((tempguy.family==eeGHINI)&&(tempguy.attributes[0])) | |
| 14865 | { | ||
| 14866 | ✗ | if(get_bit(deprecated_rules, qr_GHINI2BLINK_DEP)) | |
| 14867 | { | ||
| 14868 | ✗ | tempguy.flags |= guy_blinking; | |
| 14869 | ✗ | } | |
| 14870 | |||
| 14871 | ✗ | if(get_bit(deprecated_rules, qr_PHANTOMGHINI2_DEP)) | |
| 14872 | { | ||
| 14873 | ✗ | tempguy.flags |= guy_transparent; | |
| 14874 | ✗ | } | |
| 14875 | ✗ | } | |
| 14876 | ✗ | } | |
| 14877 | |||
| 14878 |
1/2✓ Branch 0 taken 202752 times.
✗ Branch 1 not taken.
|
202752 | if(guyversion < 15) // July 2009 - Guy Fire and Fairy fix |
| 14879 | { | ||
| 14880 | ✗ | if(i==gFIRE) | |
| 14881 | { | ||
| 14882 | ✗ | tempguy.e_anim = aFLIP; | |
| 14883 | ✗ | tempguy.e_frate = 24; | |
| 14884 | ✗ | } | |
| 14885 | |||
| 14886 | ✗ | if(i==gFAIRY) | |
| 14887 | { | ||
| 14888 | ✗ | tempguy.e_anim = a2FRM; | |
| 14889 | ✗ | tempguy.e_frate = 16; | |
| 14890 | ✗ | } | |
| 14891 | ✗ | } | |
| 14892 | |||
| 14893 |
1/2✓ Branch 0 taken 202752 times.
✗ Branch 1 not taken.
|
202752 | if(guyversion < 16) // November 2009 - Super Enemy Editor part 1 |
| 14894 | { | ||
| 14895 | ✗ | if(i==0) Z_message("Updating guys to version 16...\n"); | |
| 14896 | |||
| 14897 | ✗ | update_guy_1(&tempguy); | |
| 14898 | |||
| 14899 | ✗ | if(i==eMPOLSV) | |
| 14900 | { | ||
| 14901 | ✗ | tempguy.defense[edefARROW] = edCHINK; | |
| 14902 | ✗ | tempguy.defense[edefMAGIC] = ed1HKO; | |
| 14903 | ✗ | tempguy.defense[edefREFMAGIC] = ed1HKO; | |
| 14904 | ✗ | } | |
| 14905 | ✗ | } | |
| 14906 | |||
| 14907 |
1/2✓ Branch 0 taken 202752 times.
✗ Branch 1 not taken.
|
202752 | if(guyversion < 17) // December 2009 |
| 14908 | { | ||
| 14909 | ✗ | if(tempguy.family==eePROJECTILE) | |
| 14910 | { | ||
| 14911 | ✗ | tempguy.attributes[0] = 0; | |
| 14912 | ✗ | } | |
| 14913 | ✗ | } | |
| 14914 | |||
| 14915 |
1/2✓ Branch 0 taken 202752 times.
✗ Branch 1 not taken.
|
202752 | if(guyversion < 18) // January 2010 |
| 14916 | { | ||
| 14917 | ✗ | bool boss = (tempguy.family == eeAQUA || tempguy.family==eeDONGO || tempguy.family == eeMANHAN || tempguy.family == eeGHOMA || tempguy.family==eeDIG | |
| 14918 | ✗ | || tempguy.family == eeGLEEOK || tempguy.family==eePATRA || tempguy.family == eeGANON || tempguy.family==eeMOLD); | |
| 14919 | |||
| 14920 | ✗ | tempguy.hitsfx = (boss && tempguy.family != eeMOLD && tempguy.family != eeDONGO && tempguy.family != eeDIG) ? WAV_GASP : 0; | |
| 14921 | ✗ | tempguy.deadsfx = (boss && (tempguy.family != eeDIG || tempguy.attributes[9] == 0)) ? WAV_GASP : WAV_EDEAD; | |
| 14922 | |||
| 14923 | ✗ | if(tempguy.family == eeAQUA) | |
| 14924 | ✗ | for(int32_t j=0; j<edefLAST; j++) tempguy.defense[j] = default_guys[eRAQUAM].defense[j]; | |
| 14925 | ✗ | else if(tempguy.family == eeMANHAN) | |
| 14926 | ✗ | for(int32_t j=0; j<edefLAST; j++) tempguy.defense[j] = default_guys[eMANHAN].defense[j]; | |
| 14927 | ✗ | else if(tempguy.family==eePATRA) | |
| 14928 | ✗ | for(int32_t j=0; j<edefLAST; j++) tempguy.defense[j] = default_guys[eGLEEOK1].defense[j]; | |
| 14929 | ✗ | else if(tempguy.family==eeGHOMA) | |
| 14930 | { | ||
| 14931 | ✗ | for(int32_t j=0; j<edefLAST; j++) | |
| 14932 | ✗ | tempguy.defense[j] = default_guys[eGOHMA1].defense[j]; | |
| 14933 | |||
| 14934 | ✗ | tempguy.defense[edefARROW] = ((tempguy.attributes[0]==3) ? edCHINKL8 : (tempguy.attributes[0]==2) ? edCHINKL4 : 0); | |
| 14935 | |||
| 14936 | ✗ | if(tempguy.attributes[0]==3 && !tempguy.weapon) tempguy.weapon = ewFlame; | |
| 14937 | |||
| 14938 | ✗ | tempguy.attributes[0]--; | |
| 14939 | ✗ | } | |
| 14940 | ✗ | else if(tempguy.family == eeGLEEOK) | |
| 14941 | { | ||
| 14942 | ✗ | for(int32_t j=0; j<edefLAST; j++) | |
| 14943 | ✗ | tempguy.defense[j] = default_guys[eGLEEOK1].defense[j]; | |
| 14944 | |||
| 14945 | ✗ | if(tempguy.attributes[2]==1 && !tempguy.weapon) tempguy.weapon = ewFlame; | |
| 14946 | ✗ | } | |
| 14947 | ✗ | else if(tempguy.family == eeARMOS) | |
| 14948 | { | ||
| 14949 | ✗ | tempguy.family=eeWALK; | |
| 14950 | ✗ | tempguy.hrate = 0; | |
| 14951 | ✗ | tempguy.attributes[9] = tempguy.attributes[0]; | |
| 14952 | ✗ | tempguy.attributes[0] = tempguy.attributes[1] = tempguy.attributes[2] = tempguy.attributes[3] = tempguy.attributes[4] = tempguy.attributes[5] = tempguy.attributes[6] = tempguy.attributes[7] = 0; | |
| 14953 | ✗ | tempguy.attributes[0] = tempguy.attributes[1] = tempguy.attributes[2] = tempguy.attributes[3] = tempguy.attributes[4] = tempguy.attributes[5] = tempguy.attributes[6] = tempguy.attributes[7] = 0; | |
| 14954 | ✗ | tempguy.attributes[8] = e9tARMOS; | |
| 14955 | ✗ | } | |
| 14956 | ✗ | else if(tempguy.family == eeGHINI && !tempguy.attributes[0]) | |
| 14957 | { | ||
| 14958 | ✗ | tempguy.family=eeWALK; | |
| 14959 | ✗ | tempguy.hrate = 0; | |
| 14960 | ✗ | tempguy.attributes[0] = tempguy.attributes[1] = tempguy.attributes[2] = tempguy.attributes[3] = tempguy.attributes[4] = tempguy.attributes[5] = | |
| 14961 | ✗ | tempguy.attributes[6] = tempguy.attributes[7] = tempguy.attributes[8] = tempguy.attributes[9] = 0; | |
| 14962 | ✗ | } | |
| 14963 | |||
| 14964 | // Spawn animation flags | ||
| 14965 | ✗ | if(tempguy.family == eeWALK && (tempguy.flags&guy_armos || tempguy.flags&guy_ghini)) | |
| 14966 | ✗ | tempguy.flags |= guy_fade_flicker; | |
| 14967 | else | ||
| 14968 | ✗ | tempguy.flags &= (guy_flags)0x0F00000F; // Get rid of the unused flags! | |
| 14969 | ✗ | } | |
| 14970 | |||
| 14971 |
1/2✓ Branch 0 taken 202752 times.
✗ Branch 1 not taken.
|
202752 | if(guyversion < 20) // April 2010 |
| 14972 | { | ||
| 14973 | ✗ | if(tempguy.family == eeTRAP) | |
| 14974 | { | ||
| 14975 | ✗ | tempguy.attributes[1] = tempguy.attributes[9]; | |
| 14976 | |||
| 14977 | ✗ | if(tempguy.attributes[9]>=1) | |
| 14978 | { | ||
| 14979 | ✗ | tempguy.attributes[0]++; | |
| 14980 | ✗ | } | |
| 14981 | |||
| 14982 | ✗ | tempguy.attributes[9] = 0; | |
| 14983 | ✗ | } | |
| 14984 | |||
| 14985 | // Bomb Blast fix | ||
| 14986 | ✗ | if(tempguy.weapon==ewBomb && tempguy.family!=eeROPE && (tempguy.family!=eeWALK || tempguy.attributes[1] != e2tBOMBCHU)) | |
| 14987 | ✗ | tempguy.weapon = ewLitBomb; | |
| 14988 | ✗ | else if(tempguy.weapon==ewSBomb && tempguy.family!=eeROPE && (tempguy.family!=eeWALK || tempguy.attributes[1] != e2tBOMBCHU)) | |
| 14989 | ✗ | tempguy.weapon = ewLitSBomb; | |
| 14990 | ✗ | } | |
| 14991 | |||
| 14992 |
1/2✓ Branch 0 taken 202752 times.
✗ Branch 1 not taken.
|
202752 | if(guyversion < 21) // September 2011 |
| 14993 | { | ||
| 14994 | ✗ | if(tempguy.family == eeKEESE || tempguy.family == eeKEESETRIB) | |
| 14995 | { | ||
| 14996 | ✗ | if(tempguy.family == eeKEESETRIB) | |
| 14997 | { | ||
| 14998 | ✗ | tempguy.family = eeKEESE; | |
| 14999 | ✗ | tempguy.attributes[1] = e2tKEESETRIB; | |
| 15000 | ✗ | tempguy.attributes[0] = 0; | |
| 15001 | ✗ | } | |
| 15002 | |||
| 15003 | ✗ | tempguy.rate = 2; | |
| 15004 | ✗ | tempguy.hrate = 8; | |
| 15005 | ✗ | tempguy.homing = 0; | |
| 15006 | ✗ | tempguy.step= (tempguy.family == eeKEESE && tempguy.attributes[0] ? 100:62); | |
| 15007 | ✗ | } | |
| 15008 | ✗ | else if(tempguy.family == eePEAHAT || tempguy.family==eePATRA) | |
| 15009 | { | ||
| 15010 | ✗ | if(tempguy.family == eePEAHAT) | |
| 15011 | { | ||
| 15012 | ✗ | tempguy.rate = 4; | |
| 15013 | ✗ | tempguy.step = 62; | |
| 15014 | ✗ | } | |
| 15015 | else | ||
| 15016 | ✗ | tempguy.step = 25; | |
| 15017 | |||
| 15018 | ✗ | tempguy.hrate = 8; | |
| 15019 | ✗ | tempguy.homing = 0; | |
| 15020 | ✗ | } | |
| 15021 | ✗ | else if(tempguy.family == eeDIG || tempguy.family == eeMANHAN) | |
| 15022 | { | ||
| 15023 | ✗ | if(tempguy.family == eeMANHAN) | |
| 15024 | ✗ | tempguy.step=50; | |
| 15025 | |||
| 15026 | ✗ | tempguy.hrate = 16; | |
| 15027 | ✗ | tempguy.homing = 0; | |
| 15028 | ✗ | } | |
| 15029 | ✗ | else if(tempguy.family == eeGLEEOK) | |
| 15030 | { | ||
| 15031 | ✗ | tempguy.rate = 2; | |
| 15032 | ✗ | tempguy.homing = 0; | |
| 15033 | ✗ | tempguy.hrate = 9; | |
| 15034 | ✗ | tempguy.step=89; | |
| 15035 | ✗ | } | |
| 15036 | ✗ | else if(tempguy.family == eeGHINI) | |
| 15037 | { | ||
| 15038 | ✗ | tempguy.rate = 4; | |
| 15039 | ✗ | tempguy.hrate = 12; | |
| 15040 | ✗ | tempguy.step=62; | |
| 15041 | ✗ | tempguy.homing = 0; | |
| 15042 | ✗ | } | |
| 15043 | |||
| 15044 | // Bigdig random rate fix | ||
| 15045 | ✗ | if(tempguy.family==eeDIG && tempguy.attributes[9]==1) | |
| 15046 | { | ||
| 15047 | ✗ | tempguy.rate = 2; | |
| 15048 | ✗ | } | |
| 15049 | ✗ | } | |
| 15050 | |||
| 15051 |
1/2✓ Branch 0 taken 202752 times.
✗ Branch 1 not taken.
|
202752 | if(guyversion < 24) // November 2012 |
| 15052 | { | ||
| 15053 | ✗ | if(tempguy.family==eeLANM) | |
| 15054 | ✗ | tempguy.attributes[2] = 1; | |
| 15055 | ✗ | else if(tempguy.family==eeMOLD) | |
| 15056 | ✗ | tempguy.attributes[1] = 0; | |
| 15057 | ✗ | } | |
| 15058 | |||
| 15059 |
2/2✓ Branch 0 taken 100352 times.
✓ Branch 1 taken 102400 times.
|
202752 | if(guyversion < 33) //Whistle defence did not exist before this version of 2.54. -Z |
| 15060 | { | ||
| 15061 |
2/2✓ Branch 0 taken 1400 times.
✓ Branch 1 taken 101000 times.
|
102400 | if(tempguy.family!=eeDIG) |
| 15062 | { | ||
| 15063 | 101000 | tempguy.defense[edefWhistle] = edIGNORE; //Might need to be ignore, universally. | |
| 15064 | 101000 | } | |
| 15065 | |||
| 15066 | 102400 | } | |
| 15067 | // does not seem to solve the issue! | ||
| 15068 |
1/2✓ Branch 0 taken 202752 times.
✗ Branch 1 not taken.
|
202752 | if ( Header->zelda_version <= 0x210 ) |
| 15069 | { | ||
| 15070 | ✗ | al_trace("Detected version %d for dodongo patch.\n",Header->zelda_version); | |
| 15071 | ✗ | if ( tempguy.family == eeDONGO ) | |
| 15072 | { | ||
| 15073 | ✗ | tempguy.deadsfx = 15; //In 2.10 and earlier, Dodongos used this as their death sound. | |
| 15074 | ✗ | } | |
| 15075 | ✗ | } | |
| 15076 | |||
| 15077 |
2/2✓ Branch 0 taken 100352 times.
✓ Branch 1 taken 102400 times.
|
202752 | if(guyversion >= 42) |
| 15078 | { | ||
| 15079 |
2/2✓ Branch 0 taken 98304 times.
✓ Branch 1 taken 2048 times.
|
100352 | if(guyversion >= 47) |
| 15080 | { | ||
| 15081 |
1/2✓ Branch 0 taken 98304 times.
✗ Branch 1 not taken.
|
98304 | if(!p_igetl(&(tempguy.moveflags),f)) |
| 15082 | { | ||
| 15083 | ✗ | return qe_invalid; | |
| 15084 | } | ||
| 15085 | 98304 | } | |
| 15086 | else | ||
| 15087 | { | ||
| 15088 | byte fl; | ||
| 15089 |
1/2✓ Branch 0 taken 2048 times.
✗ Branch 1 not taken.
|
2048 | if(!p_getc(&fl,f)) |
| 15090 | { | ||
| 15091 | ✗ | return qe_invalid; | |
| 15092 | } | ||
| 15093 | 2048 | tempguy.moveflags = (move_flags)fl; | |
| 15094 | } | ||
| 15095 | 100352 | } | |
| 15096 | else | ||
| 15097 | { | ||
| 15098 |
7/8✓ Branch 0 taken 3056 times.
✓ Branch 1 taken 80670 times.
✓ Branch 2 taken 2717 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 958 times.
✓ Branch 5 taken 642 times.
✓ Branch 6 taken 498 times.
✓ Branch 7 taken 13859 times.
|
102400 | switch(tempguy.family) |
| 15099 | { | ||
| 15100 | //No gravity; floats over pits | ||
| 15101 | case eeTEK: case eePEAHAT: case eeROCK: case eeTRAP: | ||
| 15102 | case eePROJECTILE: case eeSPINTILE: case eeKEESE: case eeFIRE: | ||
| 15103 | //Special (bosses, etc) | ||
| 15104 | case eeFAIRY: case eeGUY: case eeNONE: case eeZORA: | ||
| 15105 | case eeAQUA: case eeDIG: case eeGHOMA: case eeGANON: | ||
| 15106 | case eePATRA: case eeGLEEOK: case eeMOLD: case eeMANHAN: | ||
| 15107 | 80670 | tempguy.moveflags = move_can_pitwalk; | |
| 15108 | 80670 | break; | |
| 15109 | //No gravity, but falls in pits | ||
| 15110 | case eeLEV: | ||
| 15111 | 958 | tempguy.moveflags = move_can_pitfall; | |
| 15112 | 958 | break; | |
| 15113 | //Bosses that respect pits | ||
| 15114 | case eeDONGO: | ||
| 15115 | 642 | tempguy.moveflags = move_obeys_grav; | |
| 15116 | 642 | break; | |
| 15117 | case eeLANM: | ||
| 15118 | 498 | tempguy.moveflags = move_none; | |
| 15119 | 498 | break; | |
| 15120 | //Gravity, floats over pits | ||
| 15121 | case eeWIZZ: case eeWALLM: case eeGHINI: | ||
| 15122 | 2717 | tempguy.moveflags = move_obeys_grav | move_can_pitwalk; | |
| 15123 | 2717 | break; | |
| 15124 | //Gravity and falls in pits | ||
| 15125 | case eeWALK: | ||
| 15126 |
4/4✓ Branch 0 taken 13164 times.
✓ Branch 1 taken 695 times.
✓ Branch 2 taken 529 times.
✓ Branch 3 taken 12635 times.
|
13859 | if (tempguy.attributes[8]==e9tPOLSVOICE||tempguy.attributes[8]==e9tVIRE) |
| 15127 | 1224 | break; | |
| 15128 | [[fallthrough]]; | ||
| 15129 | case eeOTHER: | ||
| 15130 | case eeSCRIPT01: case eeSCRIPT02: case eeSCRIPT03: case eeSCRIPT04: case eeSCRIPT05: | ||
| 15131 | case eeSCRIPT06: case eeSCRIPT07: case eeSCRIPT08: case eeSCRIPT09: case eeSCRIPT10: | ||
| 15132 | case eeSCRIPT11: case eeSCRIPT12: case eeSCRIPT13: case eeSCRIPT14: case eeSCRIPT15: | ||
| 15133 | case eeSCRIPT16: case eeSCRIPT17: case eeSCRIPT18: case eeSCRIPT19: case eeSCRIPT20: | ||
| 15134 | case eeFFRIENDLY01: case eeFFRIENDLY02: case eeFFRIENDLY03: case eeFFRIENDLY04: case eeFFRIENDLY05: | ||
| 15135 | case eeFFRIENDLY06: case eeFFRIENDLY07: case eeFFRIENDLY08: case eeFFRIENDLY09: case eeFFRIENDLY10: | ||
| 15136 | 15691 | tempguy.moveflags = move_obeys_grav | move_can_pitfall; | |
| 15137 | 15691 | } | |
| 15138 | } | ||
| 15139 |
2/2✓ Branch 0 taken 100352 times.
✓ Branch 1 taken 102400 times.
|
202752 | if(guyversion < 43) |
| 15140 | { | ||
| 15141 |
2/2✓ Branch 0 taken 83387 times.
✓ Branch 1 taken 19013 times.
|
102400 | switch(tempguy.family) |
| 15142 | { | ||
| 15143 | //No gravity; floats over pits | ||
| 15144 | case eeTEK: case eePEAHAT: case eeROCK: case eeTRAP: | ||
| 15145 | case eePROJECTILE: case eeSPINTILE: case eeKEESE: case eeFIRE: | ||
| 15146 | //Special (bosses, etc) | ||
| 15147 | case eeFAIRY: case eeGUY: case eeNONE: case eeZORA: | ||
| 15148 | case eeAQUA: case eeDIG: case eeGHOMA: case eeGANON: | ||
| 15149 | case eePATRA: case eeGLEEOK: case eeMOLD: case eeMANHAN: | ||
| 15150 | case eeWIZZ: case eeWALLM: case eeGHINI: | ||
| 15151 | //Gravity, floats over pits | ||
| 15152 | 83387 | tempguy.moveflags |= move_can_waterwalk; | |
| 15153 | 83387 | tempguy.moveflags |= move_can_pitwalk; | |
| 15154 | 83387 | break; | |
| 15155 | } | ||
| 15156 | 102400 | } | |
| 15157 |
2/2✓ Branch 0 taken 100352 times.
✓ Branch 1 taken 102400 times.
|
202752 | if (guyversion < 44) |
| 15158 | { | ||
| 15159 |
2/2✓ Branch 0 taken 101487 times.
✓ Branch 1 taken 913 times.
|
102400 | if ( tempguy.family == eeGHOMA ) |
| 15160 | { | ||
| 15161 | 913 | tempguy.flags |= guy_fade_instant; | |
| 15162 | 913 | } | |
| 15163 | 102400 | } | |
| 15164 |
2/2✓ Branch 0 taken 100352 times.
✓ Branch 1 taken 102400 times.
|
202752 | if (guyversion > 44) |
| 15165 | { | ||
| 15166 |
1/2✓ Branch 0 taken 100352 times.
✗ Branch 1 not taken.
|
100352 | if(!p_getc(&(tempguy.spr_shadow),f)) |
| 15167 | { | ||
| 15168 | ✗ | return qe_invalid; | |
| 15169 | } | ||
| 15170 |
1/2✓ Branch 0 taken 100352 times.
✗ Branch 1 not taken.
|
100352 | if(!p_getc(&(tempguy.spr_death),f)) |
| 15171 | { | ||
| 15172 | ✗ | return qe_invalid; | |
| 15173 | } | ||
| 15174 |
1/2✓ Branch 0 taken 100352 times.
✗ Branch 1 not taken.
|
100352 | if(!p_getc(&(tempguy.spr_spawn),f)) |
| 15175 | { | ||
| 15176 | ✗ | return qe_invalid; | |
| 15177 | } | ||
| 15178 | 100352 | } | |
| 15179 | else | ||
| 15180 | { | ||
| 15181 |
2/2✓ Branch 0 taken 102003 times.
✓ Branch 1 taken 397 times.
|
102400 | tempguy.spr_shadow = (tempguy.family==eeROCK && tempguy.attributes[9]==1) ? iwLargeShadow : iwShadow; |
| 15182 | 102400 | tempguy.spr_death = iwDeath; | |
| 15183 | 102400 | tempguy.spr_spawn = iwSpawn; | |
| 15184 | } | ||
| 15185 | |||
| 15186 |
2/2✓ Branch 0 taken 100352 times.
✓ Branch 1 taken 102400 times.
|
202752 | if(guyversion < 46) |
| 15187 | { | ||
| 15188 |
4/4✓ Branch 0 taken 13859 times.
✓ Branch 1 taken 88541 times.
✓ Branch 2 taken 13164 times.
✓ Branch 3 taken 695 times.
|
102400 | if(tempguy.family == eeWALK && tempguy.attributes[8] == e9tPOLSVOICE) |
| 15189 | { | ||
| 15190 | 695 | tempguy.moveflags |= move_can_waterwalk; | |
| 15191 | 695 | } | |
| 15192 | 102400 | } | |
| 15193 | |||
| 15194 |
2/2✓ Branch 0 taken 98304 times.
✓ Branch 1 taken 104448 times.
|
202752 | if (guyversion < 47) |
| 15195 | { | ||
| 15196 |
4/4✓ Branch 0 taken 1424 times.
✓ Branch 1 taken 103024 times.
✓ Branch 2 taken 852 times.
✓ Branch 3 taken 572 times.
|
104448 | if (tempguy.family == eeDIG && tempguy.attributes[9]!=1) |
| 15197 | { | ||
| 15198 | 572 | tempguy.flags |= guy_ignore_kill_all; | |
| 15199 | 572 | } | |
| 15200 | 104448 | } | |
| 15201 | |||
| 15202 |
2/2✓ Branch 0 taken 77824 times.
✓ Branch 1 taken 124928 times.
|
202752 | if (guyversion < 49) |
| 15203 | { | ||
| 15204 |
8/8✓ Branch 0 taken 16331 times.
✓ Branch 1 taken 108597 times.
✓ Branch 2 taken 15861 times.
✓ Branch 3 taken 470 times.
✓ Branch 4 taken 15380 times.
✓ Branch 5 taken 481 times.
✓ Branch 6 taken 526 times.
✓ Branch 7 taken 14854 times.
|
124928 | if (tempguy.family == eeWALK && (tempguy.attributes[6]==e7tPERMJINX || tempguy.attributes[6]==e7tTEMPJINX || tempguy.attributes[6]==e7tUNJINX)) //BUBBLE CHECK |
| 15205 | { | ||
| 15206 |
3/4✗ Branch 0 not taken.
✓ Branch 1 taken 707 times.
✓ Branch 2 taken 709 times.
✓ Branch 3 taken 61 times.
|
1477 | switch (tempguy.attributes[7]) { |
| 15207 | case 0: //Sword | ||
| 15208 | 707 | tempguy.attributes[7] = e8tSWORD; | |
| 15209 | 707 | break; | |
| 15210 | case 1: //Item | ||
| 15211 | 709 | tempguy.attributes[7] = e8tITEM; | |
| 15212 | 709 | break; | |
| 15213 | case 2: //Both | ||
| 15214 | 61 | tempguy.attributes[7] = e8tSWORD|e8tITEM; | |
| 15215 | 61 | break; | |
| 15216 | default: //this can actually happen since Misc8 can be set to any number. | ||
| 15217 | ✗ | tempguy.attributes[7] = 0; | |
| 15218 | ✗ | break; | |
| 15219 | } | ||
| 15220 | 1477 | } | |
| 15221 | 124928 | } | |
| 15222 | |||
| 15223 | //these could possible be combined but rather be safe... | ||
| 15224 |
2/2✓ Branch 0 taken 77824 times.
✓ Branch 1 taken 124928 times.
|
202752 | if (guyversion < 51) //reimport the firesfx, zoria ducked up. |
| 15225 | { | ||
| 15226 | 124928 | guy_update_firesfx(tempguy); | |
| 15227 | 124928 | } | |
| 15228 |
2/2✓ Branch 0 taken 124928 times.
✓ Branch 1 taken 77824 times.
|
202752 | if (guyversion < 52) |
| 15229 | { | ||
| 15230 | 124928 | guy_update_weaponflags(tempguy); | |
| 15231 | 124928 | } | |
| 15232 |
2/2✓ Branch 0 taken 65024 times.
✓ Branch 1 taken 12800 times.
|
77824 | else if(guyversion < 54) |
| 15233 | { | ||
| 15234 |
1/2✓ Branch 0 taken 12800 times.
✗ Branch 1 not taken.
|
12800 | if (!p_getc(&(tempguy.weap_data.unblockable), f)) |
| 15235 | ✗ | return qe_invalid; | |
| 15236 |
1/2✓ Branch 0 taken 12800 times.
✗ Branch 1 not taken.
|
12800 | if (!p_igetl(&(tempguy.weap_data.moveflags), f)) |
| 15237 | ✗ | return qe_invalid; | |
| 15238 |
1/2✓ Branch 0 taken 12800 times.
✗ Branch 1 not taken.
|
12800 | if (!p_igetl(&(tempguy.weap_data.override_flags), f)) |
| 15239 | ✗ | return qe_invalid; | |
| 15240 |
1/2✓ Branch 0 taken 12800 times.
✗ Branch 1 not taken.
|
12800 | if (!p_igetl(&(tempguy.weap_data.tilew), f)) |
| 15241 | ✗ | return qe_invalid; | |
| 15242 |
1/2✓ Branch 0 taken 12800 times.
✗ Branch 1 not taken.
|
12800 | if (!p_igetl(&(tempguy.weap_data.tileh), f)) |
| 15243 | ✗ | return qe_invalid; | |
| 15244 |
1/2✓ Branch 0 taken 12800 times.
✗ Branch 1 not taken.
|
12800 | if (!p_igetl(&(tempguy.weap_data.hxsz), f)) |
| 15245 | ✗ | return qe_invalid; | |
| 15246 |
1/2✓ Branch 0 taken 12800 times.
✗ Branch 1 not taken.
|
12800 | if (!p_igetl(&(tempguy.weap_data.hysz), f)) |
| 15247 | ✗ | return qe_invalid; | |
| 15248 |
1/2✓ Branch 0 taken 12800 times.
✗ Branch 1 not taken.
|
12800 | if (!p_igetl(&(tempguy.weap_data.hzsz), f)) |
| 15249 | ✗ | return qe_invalid; | |
| 15250 |
1/2✓ Branch 0 taken 12800 times.
✗ Branch 1 not taken.
|
12800 | if (!p_igetl(&(tempguy.weap_data.hxofs), f)) |
| 15251 | ✗ | return qe_invalid; | |
| 15252 |
1/2✓ Branch 0 taken 12800 times.
✗ Branch 1 not taken.
|
12800 | if (!p_igetl(&(tempguy.weap_data.hyofs), f)) |
| 15253 | ✗ | return qe_invalid; | |
| 15254 |
1/2✓ Branch 0 taken 12800 times.
✗ Branch 1 not taken.
|
12800 | if (!p_igetl(&(tempguy.weap_data.xofs), f)) |
| 15255 | ✗ | return qe_invalid; | |
| 15256 |
1/2✓ Branch 0 taken 12800 times.
✗ Branch 1 not taken.
|
12800 | if (!p_igetl(&(tempguy.weap_data.yofs), f)) |
| 15257 | ✗ | return qe_invalid; | |
| 15258 | int32_t temp_step; | ||
| 15259 |
1/2✓ Branch 0 taken 12800 times.
✗ Branch 1 not taken.
|
12800 | if (!p_igetl(&temp_step, f)) |
| 15260 | ✗ | return qe_invalid; | |
| 15261 | 12800 | tempguy.weap_data.step = zslongToFix(temp_step*100); | |
| 15262 |
2/2✓ Branch 0 taken 64000 times.
✓ Branch 1 taken 12800 times.
|
76800 | for (int32_t q = 0; q < WPNSPR_MAX; ++q) |
| 15263 | { | ||
| 15264 |
1/2✓ Branch 0 taken 64000 times.
✗ Branch 1 not taken.
|
64000 | if (!p_igetw(&(tempguy.weap_data.burnsprs[q]), f)) |
| 15265 | ✗ | return qe_invalid; | |
| 15266 |
1/2✓ Branch 0 taken 64000 times.
✗ Branch 1 not taken.
|
64000 | if (!p_igetw(&(tempguy.weap_data.light_rads[q]), f)) |
| 15267 | ✗ | return qe_invalid; | |
| 15268 | 64000 | } | |
| 15269 | 12800 | } | |
| 15270 |
2/2✓ Branch 0 taken 124928 times.
✓ Branch 1 taken 77824 times.
|
202752 | if (guyversion < 53) |
| 15271 | { | ||
| 15272 | 124928 | guy_update_weaponspecialsfx(tempguy); | |
| 15273 | 124928 | } | |
| 15274 | else | ||
| 15275 | { | ||
| 15276 |
1/2✓ Branch 0 taken 77824 times.
✗ Branch 1 not taken.
|
77824 | if (!p_getc(&(tempguy.specialsfx), f)) |
| 15277 | ✗ | return qe_invalid; | |
| 15278 | } | ||
| 15279 | |||
| 15280 |
2/2✓ Branch 0 taken 65024 times.
✓ Branch 1 taken 137728 times.
|
202752 | if(guyversion >= 54) |
| 15281 | { | ||
| 15282 |
1/2✓ Branch 0 taken 65024 times.
✗ Branch 1 not taken.
|
65024 | if(auto ret = read_weap_data(tempguy.weap_data, f)) |
| 15283 | ✗ | return ret; | |
| 15284 | 65024 | } | |
| 15285 | else | ||
| 15286 | { | ||
| 15287 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 137728 times.
|
137728 | SETFLAG(tempguy.weap_data.wflags, WFLAG_UPDATE_IGNITE_SPRITE, tempguy.flags & guy_burning_sprites); |
| 15288 | 137728 | tempguy.weap_data.flags |= wdata_set_step; | |
| 15289 |
2/2✓ Branch 0 taken 136057 times.
✓ Branch 1 taken 1671 times.
|
137728 | if(tempguy.weapon == ewRock) |
| 15290 | 1671 | tempguy.weap_data.wflags |= WFLAG_BREAK_ON_SOLID; | |
| 15291 | } | ||
| 15292 | |||
| 15293 |
1/2✓ Branch 0 taken 202752 times.
✗ Branch 1 not taken.
|
202752 | if(loading_tileset_flags & TILESET_CLEARSCRIPTS) |
| 15294 | { | ||
| 15295 | ✗ | tempguy.script = 0; | |
| 15296 | ✗ | for(int q = 0; q < 8; ++q) | |
| 15297 | ✗ | tempguy.initD[q] = 0; | |
| 15298 | ✗ | } | |
| 15299 | 202752 | guysbuf[i] = tempguy; | |
| 15300 | 202752 | } | |
| 15301 | 396 | } | |
| 15302 | |||
| 15303 | 396 | return 0; | |
| 15304 | 478 | } | |
| 15305 | |||
| 15306 | ✗ | void update_guy_1(guydata *tempguy) // November 2009 | |
| 15307 | { | ||
| 15308 | ✗ | bool doesntcount = false; | |
| 15309 | ✗ | tempguy->flags &= ~guy_weak_arrow; // Formerly 'weak to arrow' which wasn't implemented | |
| 15310 | |||
| 15311 | ✗ | switch(tempguy->family) | |
| 15312 | { | ||
| 15313 | case 1: //eeWALK | ||
| 15314 | ✗ | switch(tempguy->attributes[9]) | |
| 15315 | { | ||
| 15316 | case 0: //Stalfos | ||
| 15317 | ✗ | if(tempguy->attributes[0]==1) // Fires four projectiles at once | |
| 15318 | ✗ | tempguy->attributes[0]=4; | |
| 15319 | |||
| 15320 | ✗ | break; | |
| 15321 | |||
| 15322 | case 1: //Darknut | ||
| 15323 | ✗ | goto darknuts; | |
| 15324 | break; | ||
| 15325 | } | ||
| 15326 | |||
| 15327 | ✗ | tempguy->attributes[9] = 0; | |
| 15328 | ✗ | break; | |
| 15329 | |||
| 15330 | case 2: //eeSHOOT | ||
| 15331 | ✗ | tempguy->family = eeWALK; | |
| 15332 | |||
| 15333 | ✗ | switch(tempguy->attributes[9]) | |
| 15334 | { | ||
| 15335 | case 0: //Octorok | ||
| 15336 | ✗ | if(tempguy->attributes[0]==1||tempguy->attributes[0]==2) | |
| 15337 | { | ||
| 15338 | ✗ | tempguy->attributes[0]=e1tFIREOCTO; | |
| 15339 | ✗ | tempguy->attributes[1]=e2tFIREOCTO; | |
| 15340 | ✗ | } | |
| 15341 | ✗ | else tempguy->attributes[0] = 0; | |
| 15342 | |||
| 15343 | ✗ | tempguy->attributes[5]=tempguy->attributes[3]; | |
| 15344 | ✗ | tempguy->attributes[3]=tempguy->attributes[2]; | |
| 15345 | ✗ | tempguy->attributes[2]=0; | |
| 15346 | ✗ | break; | |
| 15347 | |||
| 15348 | case 1: // Moblin | ||
| 15349 | ✗ | tempguy->attributes[0] = 0; | |
| 15350 | ✗ | break; | |
| 15351 | |||
| 15352 | case 2: //Lynel | ||
| 15353 | ✗ | tempguy->attributes[5]=tempguy->attributes[0]+1; | |
| 15354 | ✗ | tempguy->attributes[0]=0; | |
| 15355 | ✗ | break; | |
| 15356 | |||
| 15357 | case 3: //Stalfos 2 | ||
| 15358 | ✗ | if(tempguy->attributes[0]==1) // Fires four projectiles at once | |
| 15359 | ✗ | tempguy->attributes[0]=e1t4SHOTS; | |
| 15360 | ✗ | else tempguy->attributes[0] = 0; | |
| 15361 | |||
| 15362 | ✗ | break; | |
| 15363 | |||
| 15364 | case 4: //Darknut 5 | ||
| 15365 | darknuts: | ||
| 15366 | ✗ | tempguy->defense[edefFIRE] = edIGNORE; | |
| 15367 | ✗ | tempguy->defense[edefBRANG] = edSTUNORCHINK; | |
| 15368 | ✗ | tempguy->defense[edefHOOKSHOT] = 0; | |
| 15369 | ✗ | tempguy->defense[edefARROW] = tempguy->defense[edefBYRNA] = tempguy->defense[edefREFROCK] = | |
| 15370 | ✗ | tempguy->defense[edefMAGIC] = tempguy->defense[edefSTOMP] = edCHINK; | |
| 15371 | |||
| 15372 | ✗ | if(tempguy->attributes[0]==1) | |
| 15373 | ✗ | tempguy->attributes[0]=2; | |
| 15374 | ✗ | else if(tempguy->attributes[0]==2) | |
| 15375 | { | ||
| 15376 | ✗ | tempguy->attributes[3]=tempguy->attributes[2]; | |
| 15377 | ✗ | tempguy->attributes[2]=tempguy->attributes[1]; | |
| 15378 | ✗ | tempguy->attributes[1]=e2tSPLIT; | |
| 15379 | ✗ | tempguy->attributes[0] = 0; | |
| 15380 | ✗ | } | |
| 15381 | ✗ | else tempguy->attributes[0] = 0; | |
| 15382 | |||
| 15383 | ✗ | tempguy->flags |= guy_shield_front; | |
| 15384 | |||
| 15385 | ✗ | if(!get_bit(deprecated_rules,qr_BRKBLSHLDS_DEP)) | |
| 15386 | ✗ | tempguy->flags &= ~guy_bkshield; | |
| 15387 | else | ||
| 15388 | ✗ | tempguy->flags |= guy_bkshield; | |
| 15389 | |||
| 15390 | ✗ | break; | |
| 15391 | } | ||
| 15392 | |||
| 15393 | ✗ | tempguy->attributes[9] = 0; | |
| 15394 | ✗ | break; | |
| 15395 | |||
| 15396 | /* | ||
| 15397 | case 9: //eeARMOS | ||
| 15398 | tempguy->family = eeWALK; | ||
| 15399 | break; | ||
| 15400 | */ | ||
| 15401 | case 11: //eeGEL | ||
| 15402 | case 33: //eeGELTRIB | ||
| 15403 | ✗ | if(tempguy->family==33) | |
| 15404 | { | ||
| 15405 | ✗ | tempguy->attributes[3] = 1; | |
| 15406 | |||
| 15407 | ✗ | if(get_bit(deprecated_rules, qr_OLDTRIBBLES_DEP)) //Old Tribbles | |
| 15408 | ✗ | tempguy->attributes[2] = tempguy->attributes[1]; | |
| 15409 | |||
| 15410 | ✗ | tempguy->attributes[1] = e2tTRIBBLE; | |
| 15411 | ✗ | } | |
| 15412 | else | ||
| 15413 | { | ||
| 15414 | ✗ | tempguy->attributes[3] = 0; | |
| 15415 | ✗ | tempguy->attributes[2] = 0; | |
| 15416 | ✗ | tempguy->attributes[1] = 0; | |
| 15417 | } | ||
| 15418 | |||
| 15419 | ✗ | tempguy->family = eeWALK; | |
| 15420 | |||
| 15421 | ✗ | if(tempguy->attributes[0]) | |
| 15422 | { | ||
| 15423 | ✗ | tempguy->attributes[0]=1; | |
| 15424 | ✗ | tempguy->weapon = ewFireTrail; | |
| 15425 | ✗ | } | |
| 15426 | |||
| 15427 | ✗ | break; | |
| 15428 | |||
| 15429 | case 34: //eeZOLTRIB | ||
| 15430 | case 12: //eeZOL | ||
| 15431 | ✗ | tempguy->attributes[3]=tempguy->attributes[2]; | |
| 15432 | ✗ | tempguy->attributes[2]=tempguy->attributes[1]; | |
| 15433 | ✗ | tempguy->family = eeWALK; | |
| 15434 | ✗ | tempguy->attributes[1]=e2tSPLITHIT; | |
| 15435 | |||
| 15436 | ✗ | if(tempguy->attributes[0]) | |
| 15437 | { | ||
| 15438 | ✗ | tempguy->attributes[0]=1; | |
| 15439 | ✗ | tempguy->weapon = ewFireTrail; | |
| 15440 | ✗ | } | |
| 15441 | |||
| 15442 | ✗ | break; | |
| 15443 | |||
| 15444 | case 13: //eeROPE | ||
| 15445 | ✗ | tempguy->family = eeWALK; | |
| 15446 | ✗ | tempguy->attributes[8] = e9tROPE; | |
| 15447 | |||
| 15448 | ✗ | if(tempguy->attributes[0]) | |
| 15449 | { | ||
| 15450 | ✗ | tempguy->attributes[3] = tempguy->attributes[2]; | |
| 15451 | ✗ | tempguy->attributes[2] = tempguy->attributes[1]; | |
| 15452 | ✗ | tempguy->attributes[1] = e2tBOMBCHU; | |
| 15453 | ✗ | } | |
| 15454 | |||
| 15455 | ✗ | tempguy->attributes[0] = 0; | |
| 15456 | ✗ | break; | |
| 15457 | |||
| 15458 | case 14: //eeGORIYA | ||
| 15459 | ✗ | tempguy->family = eeWALK; | |
| 15460 | |||
| 15461 | ✗ | if(tempguy->attributes[0]!=2) tempguy->attributes[0] = 0; | |
| 15462 | |||
| 15463 | ✗ | break; | |
| 15464 | |||
| 15465 | case 17: //eeBUBBLE | ||
| 15466 | ✗ | tempguy->family = eeWALK; | |
| 15467 | ✗ | tempguy->attributes[7] = tempguy->attributes[1]; | |
| 15468 | ✗ | tempguy->attributes[6] = tempguy->attributes[0] + 1; | |
| 15469 | ✗ | tempguy->attributes[0] = tempguy->attributes[1] = 0; | |
| 15470 | |||
| 15471 | //fallthrogh | ||
| 15472 | case eeTRAP: | ||
| 15473 | case eeROCK: | ||
| 15474 | ✗ | doesntcount = true; | |
| 15475 | ✗ | break; | |
| 15476 | |||
| 15477 | case 35: //eeVIRETRIB | ||
| 15478 | case 18: //eeVIRE | ||
| 15479 | ✗ | tempguy->family = eeWALK; | |
| 15480 | ✗ | tempguy->attributes[3]=tempguy->attributes[2]; | |
| 15481 | ✗ | tempguy->attributes[2]=tempguy->attributes[1]; | |
| 15482 | ✗ | tempguy->attributes[1]=e2tSPLITHIT; | |
| 15483 | ✗ | tempguy->attributes[8]=e9tVIRE; | |
| 15484 | ✗ | break; | |
| 15485 | |||
| 15486 | case 19: //eeLIKE | ||
| 15487 | ✗ | tempguy->family = eeWALK; | |
| 15488 | ✗ | tempguy->attributes[6] = e7tEATITEMS; | |
| 15489 | ✗ | tempguy->attributes[7]=95; | |
| 15490 | ✗ | break; | |
| 15491 | |||
| 15492 | case 20: //eePOLSV | ||
| 15493 | ✗ | tempguy->defense[edefBRANG] = edSTUNORCHINK; | |
| 15494 | ✗ | tempguy->defense[edefBOMB] = tempguy->defense[edefSBOMB] = tempguy->defense[edefFIRE] = edIGNORE; | |
| 15495 | ✗ | tempguy->defense[edefMAGIC] = tempguy->defense[edefBYRNA] = edCHINK; | |
| 15496 | ✗ | tempguy->defense[edefARROW] = ed1HKO; | |
| 15497 | ✗ | tempguy->defense[edefHOOKSHOT] = edSTUNONLY; | |
| 15498 | ✗ | tempguy->family = eeWALK; | |
| 15499 | ✗ | tempguy->attributes[8] = e9tPOLSVOICE; | |
| 15500 | ✗ | tempguy->rate = 4; | |
| 15501 | ✗ | tempguy->homing = 32; | |
| 15502 | ✗ | tempguy->hrate = 10; | |
| 15503 | ✗ | tempguy->grumble = 0; | |
| 15504 | ✗ | break; | |
| 15505 | |||
| 15506 | case eeWIZZ: | ||
| 15507 | ✗ | if(tempguy->attributes[3]) | |
| 15508 | { | ||
| 15509 | ✗ | for(int32_t i=0; i < edefLAST; i++) | |
| 15510 | ✗ | tempguy->defense[i] = (i != edefREFBEAM && i != edefREFMAGIC && i != edefQUAKE) ? edIGNORE : 0; | |
| 15511 | ✗ | } | |
| 15512 | else | ||
| 15513 | { | ||
| 15514 | ✗ | tempguy->defense[edefBRANG] = edSTUNORCHINK; | |
| 15515 | ✗ | tempguy->defense[edefMAGIC] = edCHINK; | |
| 15516 | ✗ | tempguy->defense[edefHOOKSHOT] = edSTUNONLY; | |
| 15517 | ✗ | tempguy->defense[edefARROW] = tempguy->defense[edefFIRE] = | |
| 15518 | ✗ | tempguy->defense[edefWAND] = tempguy->defense[edefBYRNA] = edIGNORE; | |
| 15519 | } | ||
| 15520 | |||
| 15521 | ✗ | break; | |
| 15522 | |||
| 15523 | case eePEAHAT: | ||
| 15524 | ✗ | tempguy->flags &= ~(guy_superman|guy_sbombonly); | |
| 15525 | |||
| 15526 | ✗ | if(!(tempguy->flags & guy_bhit)) | |
| 15527 | ✗ | tempguy->defense[edefBRANG] = edSTUNONLY; | |
| 15528 | |||
| 15529 | ✗ | break; | |
| 15530 | |||
| 15531 | case eeLEV: | ||
| 15532 | ✗ | tempguy->defense[edefSTOMP] = edCHINK; | |
| 15533 | ✗ | break; | |
| 15534 | } | ||
| 15535 | |||
| 15536 | // Old flags | ||
| 15537 | ✗ | if(tempguy->flags & guy_superman) | |
| 15538 | { | ||
| 15539 | ✗ | for(int32_t i = 0; i < edefLAST; i++) | |
| 15540 | ✗ | if(!(i==edefSBOMB && (tempguy->flags & guy_sbombonly))) | |
| 15541 | ✗ | tempguy->defense[i] = (i==edefBRANG && tempguy->defense[i] != edIGNORE | |
| 15542 | ✗ | && tempguy->family != eeROCK && tempguy->family != eeTRAP | |
| 15543 | ✗ | && tempguy->family != eePROJECTILE) ? edSTUNORIGNORE : edIGNORE; | |
| 15544 | ✗ | } | |
| 15545 | |||
| 15546 | ✗ | tempguy->flags &= ~(guy_superman|guy_sbombonly); | |
| 15547 | |||
| 15548 | ✗ | if(doesntcount) | |
| 15549 | ✗ | tempguy->flags |= (guy_doesnt_count); | |
| 15550 | ✗ | } | |
| 15551 | |||
| 15552 | 1171920 | int32_t readmapscreen_old(PACKFILE *f, zquestheader *Header, mapscr *temp_mapscr, word version, int scrind) | |
| 15553 | { | ||
| 15554 | 1171920 | bool should_skip = legacy_skip_flags && get_bit(legacy_skip_flags, skip_maps); | |
| 15555 | |||
| 15556 | byte tempbyte, padding; | ||
| 15557 | word wpadding; | ||
| 15558 | int32_t extras, secretcombos; | ||
| 15559 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1171920 times.
|
1171920 | if(!p_getc(&(temp_mapscr->valid),f)) |
| 15560 | { | ||
| 15561 | ✗ | return qe_invalid; | |
| 15562 | } | ||
| 15563 | |||
| 15564 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1171920 times.
|
1171920 | if(!p_getc(&(temp_mapscr->guy),f)) |
| 15565 | ✗ | return qe_invalid; | |
| 15566 | 1171920 | temp_mapscr->guytile = -1; //signal to use default guy values | |
| 15567 |
2/2✓ Branch 0 taken 1171320 times.
✓ Branch 1 taken 600 times.
|
1171920 | SETFLAG(temp_mapscr->roomflags,RFL_ALWAYS_GUY,temp_mapscr->guy==gFAIRY); |
| 15568 |
4/4✓ Branch 0 taken 600 times.
✓ Branch 1 taken 1171320 times.
✓ Branch 2 taken 62 times.
✓ Branch 3 taken 538 times.
|
1171920 | SETFLAG(temp_mapscr->roomflags,RFL_GUYFIRES,temp_mapscr->guy!=gFAIRY || !get_qr(qr_NOFAIRYGUYFIRES)); |
| 15569 | |||
| 15570 |
5/6✓ Branch 0 taken 1149744 times.
✓ Branch 1 taken 22176 times.
✓ Branch 2 taken 2720 times.
✓ Branch 3 taken 1147024 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 2720 times.
|
1171920 | if((Header->zelda_version < 0x192)||((Header->zelda_version == 0x192)&&(Header->build<146))) |
| 15571 | { | ||
| 15572 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 22176 times.
|
22176 | if(!p_getc(&tempbyte,f)) |
| 15573 | { | ||
| 15574 | ✗ | return qe_invalid; | |
| 15575 | } | ||
| 15576 | |||
| 15577 | 22176 | temp_mapscr->str=tempbyte; | |
| 15578 | 22176 | } | |
| 15579 | else | ||
| 15580 | { | ||
| 15581 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1149744 times.
|
1149744 | if(!p_igetw(&(temp_mapscr->str),f)) |
| 15582 | { | ||
| 15583 | ✗ | return qe_invalid; | |
| 15584 | } | ||
| 15585 | } | ||
| 15586 | |||
| 15587 |
1/2✓ Branch 0 taken 1171920 times.
✗ Branch 1 not taken.
|
1171920 | if(!p_getc(&(temp_mapscr->room),f)) |
| 15588 | { | ||
| 15589 | ✗ | return qe_invalid; | |
| 15590 | } | ||
| 15591 | |||
| 15592 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1171920 times.
|
1171920 | if(!p_getc(&(temp_mapscr->item),f)) |
| 15593 | { | ||
| 15594 | ✗ | return qe_invalid; | |
| 15595 | } | ||
| 15596 | |||
| 15597 |
3/6✓ Branch 0 taken 643416 times.
✓ Branch 1 taken 528504 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 643416 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
1171920 | if(Header->zelda_version < 0x211 || (Header->zelda_version == 0x211 && Header->build < 14)) |
| 15598 | { | ||
| 15599 | 528504 | temp_mapscr->hasitem = (temp_mapscr->item != 0) ? 1 : 0; | |
| 15600 | 528504 | } | |
| 15601 | else | ||
| 15602 | { | ||
| 15603 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 643416 times.
|
643416 | if(!p_getc(&(temp_mapscr->hasitem),f)) |
| 15604 | ✗ | return qe_invalid; | |
| 15605 | } | ||
| 15606 | |||
| 15607 |
3/4✓ Branch 0 taken 1149744 times.
✓ Branch 1 taken 22176 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 2720 times.
|
1174640 | if((Header->zelda_version < 0x192)|| |
| 15608 |
2/2✓ Branch 0 taken 2720 times.
✓ Branch 1 taken 1147024 times.
|
1149744 | ((Header->zelda_version == 0x192)&&(Header->build<154))) |
| 15609 | { | ||
| 15610 |
1/2✓ Branch 0 taken 22176 times.
✗ Branch 1 not taken.
|
22176 | if(!p_getc(&tempbyte,f)) |
| 15611 | { | ||
| 15612 | ✗ | return qe_invalid; | |
| 15613 | } | ||
| 15614 | 22176 | } | |
| 15615 | |||
| 15616 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1171920 times.
|
1171920 | if(!p_getc(&(temp_mapscr->tilewarptype[0]),f)) |
| 15617 | { | ||
| 15618 | ✗ | return qe_invalid; | |
| 15619 | } | ||
| 15620 | |||
| 15621 |
2/2✓ Branch 0 taken 1147024 times.
✓ Branch 1 taken 24896 times.
|
1171920 | if(Header->zelda_version < 0x193) |
| 15622 | { | ||
| 15623 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 24896 times.
|
24896 | if(!p_getc(&tempbyte,f)) |
| 15624 | { | ||
| 15625 | ✗ | return qe_invalid; | |
| 15626 | } | ||
| 15627 | 24896 | } | |
| 15628 | |||
| 15629 |
3/6✓ Branch 0 taken 528504 times.
✓ Branch 1 taken 643416 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 528504 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
1171920 | if((Header->zelda_version > 0x211)||((Header->zelda_version == 0x211)&&(Header->build>7))) |
| 15630 | { | ||
| 15631 |
2/2✓ Branch 0 taken 1930248 times.
✓ Branch 1 taken 643416 times.
|
2573664 | for(int32_t i=1; i<4; i++) |
| 15632 | { | ||
| 15633 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1930248 times.
|
1930248 | if(!p_getc(&(temp_mapscr->tilewarptype[i]),f)) |
| 15634 | { | ||
| 15635 | ✗ | return qe_invalid; | |
| 15636 | } | ||
| 15637 | 1930248 | } | |
| 15638 | 643416 | } | |
| 15639 | else | ||
| 15640 | { | ||
| 15641 | 528504 | temp_mapscr->tilewarptype[1]=0; | |
| 15642 | 528504 | temp_mapscr->tilewarptype[2]=0; | |
| 15643 | 528504 | temp_mapscr->tilewarptype[3]=0; | |
| 15644 | } | ||
| 15645 | |||
| 15646 |
5/6✓ Branch 0 taken 24896 times.
✓ Branch 1 taken 1147024 times.
✓ Branch 2 taken 2720 times.
✓ Branch 3 taken 22176 times.
✓ Branch 4 taken 2720 times.
✗ Branch 5 not taken.
|
1171920 | if((Header->zelda_version > 0x192)||((Header->zelda_version == 0x192)&&(Header->build>153))) |
| 15647 | { | ||
| 15648 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1149744 times.
|
1149744 | if(!p_igetw(&(temp_mapscr->door_combo_set),f)) |
| 15649 | { | ||
| 15650 | ✗ | return qe_invalid; | |
| 15651 | } | ||
| 15652 | 1149744 | } | |
| 15653 | |||
| 15654 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1171920 times.
|
1171920 | if(!p_getc(&(temp_mapscr->warpreturnx[0]),f)) |
| 15655 | { | ||
| 15656 | ✗ | return qe_invalid; | |
| 15657 | } | ||
| 15658 | |||
| 15659 | 1171920 | temp_mapscr->warpreturnx[1]=0; | |
| 15660 | 1171920 | temp_mapscr->warpreturnx[2]=0; | |
| 15661 | 1171920 | temp_mapscr->warpreturnx[3]=0; | |
| 15662 | |||
| 15663 |
3/6✓ Branch 0 taken 528504 times.
✓ Branch 1 taken 643416 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 528504 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
1171920 | if((Header->zelda_version > 0x211)||((Header->zelda_version == 0x211)&&(Header->build>7))) |
| 15664 | { | ||
| 15665 |
2/2✓ Branch 0 taken 1930248 times.
✓ Branch 1 taken 643416 times.
|
2573664 | for(int32_t i=1; i<4; i++) |
| 15666 | { | ||
| 15667 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1930248 times.
|
1930248 | if(!p_getc(&(temp_mapscr->warpreturnx[i]),f)) |
| 15668 | { | ||
| 15669 | ✗ | return qe_invalid; | |
| 15670 | } | ||
| 15671 | 1930248 | } | |
| 15672 | 643416 | } | |
| 15673 | |||
| 15674 |
1/2✓ Branch 0 taken 1171920 times.
✗ Branch 1 not taken.
|
1171920 | if(!p_getc(&(temp_mapscr->warpreturny[0]),f)) |
| 15675 | { | ||
| 15676 | ✗ | return qe_invalid; | |
| 15677 | } | ||
| 15678 | |||
| 15679 | 1171920 | temp_mapscr->warpreturny[1]=0; | |
| 15680 | 1171920 | temp_mapscr->warpreturny[2]=0; | |
| 15681 | 1171920 | temp_mapscr->warpreturny[3]=0; | |
| 15682 | |||
| 15683 |
3/6✓ Branch 0 taken 528504 times.
✓ Branch 1 taken 643416 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 528504 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
1171920 | if((Header->zelda_version > 0x211)||((Header->zelda_version == 0x211)&&(Header->build>7))) |
| 15684 | { | ||
| 15685 |
2/2✓ Branch 0 taken 1930248 times.
✓ Branch 1 taken 643416 times.
|
2573664 | for(int32_t i=1; i<4; i++) |
| 15686 | { | ||
| 15687 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1930248 times.
|
1930248 | if(!p_getc(&(temp_mapscr->warpreturny[i]),f)) |
| 15688 | { | ||
| 15689 | ✗ | return qe_invalid; | |
| 15690 | } | ||
| 15691 | 1930248 | } | |
| 15692 | |||
| 15693 |
1/2✓ Branch 0 taken 643416 times.
✗ Branch 1 not taken.
|
643416 | if(version>=18) |
| 15694 | { | ||
| 15695 |
1/2✓ Branch 0 taken 643416 times.
✗ Branch 1 not taken.
|
643416 | if(!p_igetw(&temp_mapscr->warpreturnc,f)) |
| 15696 | { | ||
| 15697 | ✗ | return qe_invalid; | |
| 15698 | } | ||
| 15699 | 643416 | } | |
| 15700 | else | ||
| 15701 | { | ||
| 15702 | byte temp; | ||
| 15703 | |||
| 15704 | ✗ | if(!p_getc(&temp,f)) | |
| 15705 | { | ||
| 15706 | ✗ | return qe_invalid; | |
| 15707 | } | ||
| 15708 | |||
| 15709 | ✗ | temp_mapscr->warpreturnc=temp<<8|temp; | |
| 15710 | } | ||
| 15711 | 643416 | } | |
| 15712 | |||
| 15713 |
1/2✓ Branch 0 taken 1171920 times.
✗ Branch 1 not taken.
|
1171920 | if(!p_getc(&(temp_mapscr->stairx),f)) |
| 15714 | |||
| 15715 | { | ||
| 15716 | ✗ | return qe_invalid; | |
| 15717 | } | ||
| 15718 | |||
| 15719 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1171920 times.
|
1171920 | if(!p_getc(&(temp_mapscr->stairy),f)) |
| 15720 | { | ||
| 15721 | ✗ | return qe_invalid; | |
| 15722 | } | ||
| 15723 | |||
| 15724 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1171920 times.
|
1171920 | if(!p_getc(&(temp_mapscr->itemx),f)) |
| 15725 | { | ||
| 15726 | ✗ | return qe_invalid; | |
| 15727 | } | ||
| 15728 | |||
| 15729 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1171920 times.
|
1171920 | if(!p_getc(&(temp_mapscr->itemy),f)) |
| 15730 | { | ||
| 15731 | ✗ | return qe_invalid; | |
| 15732 | } | ||
| 15733 | |||
| 15734 |
2/2✓ Branch 0 taken 643416 times.
✓ Branch 1 taken 528504 times.
|
1171920 | if(version > 15) // February 2009 |
| 15735 | { | ||
| 15736 |
1/2✓ Branch 0 taken 643416 times.
✗ Branch 1 not taken.
|
643416 | if(!p_igetw(&(temp_mapscr->color),f)) |
| 15737 | { | ||
| 15738 | ✗ | return qe_invalid; | |
| 15739 | } | ||
| 15740 | 643416 | } | |
| 15741 | else | ||
| 15742 | { | ||
| 15743 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 528504 times.
|
528504 | if(!p_getc(& tempbyte,f)) |
| 15744 | { | ||
| 15745 | ✗ | return qe_invalid; | |
| 15746 | } | ||
| 15747 | |||
| 15748 | 528504 | temp_mapscr->color = (word) tempbyte; | |
| 15749 | } | ||
| 15750 | |||
| 15751 |
1/2✓ Branch 0 taken 1171920 times.
✗ Branch 1 not taken.
|
1171920 | if(!p_getc(&(temp_mapscr->flags11),f)) |
| 15752 | { | ||
| 15753 | ✗ | return qe_invalid; | |
| 15754 | } | ||
| 15755 | |||
| 15756 |
2/2✓ Branch 0 taken 4687680 times.
✓ Branch 1 taken 1171920 times.
|
5859600 | for(int32_t k=0; k<4; k++) |
| 15757 | { | ||
| 15758 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4687680 times.
|
4687680 | if(!p_getc(&(temp_mapscr->door[k]),f)) |
| 15759 | { | ||
| 15760 | ✗ | return qe_invalid; | |
| 15761 | |||
| 15762 | } | ||
| 15763 | 4687680 | } | |
| 15764 | |||
| 15765 |
2/2✓ Branch 0 taken 528504 times.
✓ Branch 1 taken 643416 times.
|
1171920 | if(version <= 11) |
| 15766 | { | ||
| 15767 |
1/2✓ Branch 0 taken 528504 times.
✗ Branch 1 not taken.
|
528504 | if(!p_getc(&(tempbyte),f)) |
| 15768 | { | ||
| 15769 | ✗ | return qe_invalid; | |
| 15770 | } | ||
| 15771 | |||
| 15772 | 528504 | temp_mapscr->tilewarpdmap[0]=(word)tempbyte; | |
| 15773 | |||
| 15774 |
2/6✓ Branch 0 taken 528504 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 528504 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
528504 | if((Header->zelda_version > 0x211)||((Header->zelda_version == 0x211)&&(Header->build>7))) |
| 15775 | { | ||
| 15776 | ✗ | for(int32_t i=1; i<4; i++) | |
| 15777 | { | ||
| 15778 | ✗ | if(!p_getc(&(tempbyte),f)) | |
| 15779 | { | ||
| 15780 | ✗ | return qe_invalid; | |
| 15781 | } | ||
| 15782 | |||
| 15783 | ✗ | temp_mapscr->tilewarpdmap[i]=(word)tempbyte; | |
| 15784 | ✗ | } | |
| 15785 | ✗ | } | |
| 15786 | else | ||
| 15787 | { | ||
| 15788 | 528504 | temp_mapscr->tilewarpdmap[1]=0; | |
| 15789 | 528504 | temp_mapscr->tilewarpdmap[2]=0; | |
| 15790 | 528504 | temp_mapscr->tilewarpdmap[3]=0; | |
| 15791 | } | ||
| 15792 | 528504 | } | |
| 15793 | else | ||
| 15794 | { | ||
| 15795 |
2/2✓ Branch 0 taken 2573664 times.
✓ Branch 1 taken 643416 times.
|
3217080 | for(int32_t i=0; i<4; i++) |
| 15796 | { | ||
| 15797 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2573664 times.
|
2573664 | if(!p_igetw(&(temp_mapscr->tilewarpdmap[i]),f)) |
| 15798 | { | ||
| 15799 | ✗ | return qe_invalid; | |
| 15800 | } | ||
| 15801 | 2573664 | } | |
| 15802 | } | ||
| 15803 | |||
| 15804 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1171920 times.
|
1171920 | if(!p_getc(&(temp_mapscr->tilewarpscr[0]),f)) |
| 15805 | { | ||
| 15806 | ✗ | return qe_invalid; | |
| 15807 | } | ||
| 15808 | |||
| 15809 |
3/6✓ Branch 0 taken 528504 times.
✓ Branch 1 taken 643416 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 528504 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
1171920 | if((Header->zelda_version > 0x211)||((Header->zelda_version == 0x211)&&(Header->build>7))) |
| 15810 | { | ||
| 15811 |
2/2✓ Branch 0 taken 1930248 times.
✓ Branch 1 taken 643416 times.
|
2573664 | for(int32_t i=1; i<4; i++) |
| 15812 | { | ||
| 15813 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1930248 times.
|
1930248 | if(!p_getc(&(temp_mapscr->tilewarpscr[i]),f)) |
| 15814 | { | ||
| 15815 | ✗ | return qe_invalid; | |
| 15816 | } | ||
| 15817 | 1930248 | } | |
| 15818 | 643416 | } | |
| 15819 | else | ||
| 15820 | { | ||
| 15821 | 528504 | temp_mapscr->tilewarpscr[1]=0; | |
| 15822 | 528504 | temp_mapscr->tilewarpscr[2]=0; | |
| 15823 | 528504 | temp_mapscr->tilewarpscr[3]=0; | |
| 15824 | } | ||
| 15825 | |||
| 15826 |
2/2✓ Branch 0 taken 643416 times.
✓ Branch 1 taken 528504 times.
|
1171920 | if(version >= 15) |
| 15827 | { | ||
| 15828 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 643416 times.
|
643416 | if(!p_getc(&(temp_mapscr->tilewarpoverlayflags),f)) |
| 15829 | { | ||
| 15830 | ✗ | return qe_invalid; | |
| 15831 | } | ||
| 15832 | 643416 | } | |
| 15833 | else | ||
| 15834 | { | ||
| 15835 | 528504 | temp_mapscr->tilewarpoverlayflags=0; | |
| 15836 | } | ||
| 15837 | |||
| 15838 |
1/2✓ Branch 0 taken 1171920 times.
✗ Branch 1 not taken.
|
1171920 | if(!p_getc(&(temp_mapscr->exitdir),f)) |
| 15839 | { | ||
| 15840 | ✗ | return qe_invalid; | |
| 15841 | } | ||
| 15842 | |||
| 15843 |
2/2✓ Branch 0 taken 1147024 times.
✓ Branch 1 taken 24896 times.
|
1171920 | if(Header->zelda_version < 0x193) |
| 15844 | { | ||
| 15845 |
1/2✓ Branch 0 taken 24896 times.
✗ Branch 1 not taken.
|
24896 | if(!p_getc(&tempbyte,f)) |
| 15846 | { | ||
| 15847 | ✗ | return qe_invalid; | |
| 15848 | } | ||
| 15849 | |||
| 15850 | 24896 | } | |
| 15851 | |||
| 15852 |
4/6✓ Branch 0 taken 2720 times.
✓ Branch 1 taken 1169200 times.
✓ Branch 2 taken 2720 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 2720 times.
✗ Branch 5 not taken.
|
1171920 | if((Header->zelda_version == 0x192)&&(Header->build>145)&&(Header->build<154)) |
| 15853 | { | ||
| 15854 | ✗ | if(!p_getc(&padding,f)) | |
| 15855 | { | ||
| 15856 | ✗ | return qe_invalid; | |
| 15857 | } | ||
| 15858 | ✗ | } | |
| 15859 | |||
| 15860 |
2/2✓ Branch 0 taken 11719200 times.
✓ Branch 1 taken 1171920 times.
|
12891120 | for(int32_t k=0; k<10; k++) |
| 15861 | { | ||
| 15862 |
5/6✓ Branch 0 taken 11497440 times.
✓ Branch 1 taken 221760 times.
✓ Branch 2 taken 27200 times.
✓ Branch 3 taken 11470240 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 27200 times.
|
11719200 | if((Header->zelda_version < 0x192)||((Header->zelda_version == 0x192)&&(Header->build<10))) |
| 15863 | { | ||
| 15864 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 221760 times.
|
221760 | if(!p_getc(&tempbyte,f)) |
| 15865 | { | ||
| 15866 | ✗ | return qe_invalid; | |
| 15867 | } | ||
| 15868 | |||
| 15869 | 221760 | temp_mapscr->enemy[k]=tempbyte; | |
| 15870 | |||
| 15871 | // 76 is the highest enemy id possible to set in 1.90. Anything higher must have come | ||
| 15872 | // from corrupting when 1.90 saved the quest. | ||
| 15873 | // https://discord.com/channels/876899628556091432/1287580827164737658 | ||
| 15874 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 221760 times.
|
221760 | if (Header->zelda_version <= 0x190) |
| 15875 | { | ||
| 15876 |
1/2✓ Branch 0 taken 221760 times.
✗ Branch 1 not taken.
|
221760 | if (temp_mapscr->enemy[k] > 76) |
| 15877 | { | ||
| 15878 | ✗ | temp_mapscr->enemy[k] = 0; | |
| 15879 | ✗ | } | |
| 15880 | 221760 | } | |
| 15881 | 221760 | } | |
| 15882 | else | ||
| 15883 | { | ||
| 15884 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 11497440 times.
|
11497440 | if(!p_igetw(&(temp_mapscr->enemy[k]),f)) |
| 15885 | { | ||
| 15886 | ✗ | return qe_invalid; | |
| 15887 | } | ||
| 15888 | } | ||
| 15889 | |||
| 15890 |
5/6✓ Branch 0 taken 11497440 times.
✓ Branch 1 taken 221760 times.
✓ Branch 2 taken 27200 times.
✓ Branch 3 taken 11470240 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 27200 times.
|
11719200 | if((Header->zelda_version < 0x192)||((Header->zelda_version == 0x192)&&(Header->build<108))) |
| 15891 | { | ||
| 15892 | //using enumerations here is dangerous | ||
| 15893 | //very easy to break old quests -DD | ||
| 15894 |
2/2✓ Branch 0 taken 1342 times.
✓ Branch 1 taken 220418 times.
|
221760 | if(temp_mapscr->enemy[k]>=57) //old eGOHMA1 |
| 15895 | { | ||
| 15896 | 1342 | temp_mapscr->enemy[k]+=5; | |
| 15897 | 1342 | } | |
| 15898 |
2/2✓ Branch 0 taken 220324 times.
✓ Branch 1 taken 94 times.
|
220418 | else if(temp_mapscr->enemy[k]>=52) //old eGLEEOK2 |
| 15899 | { | ||
| 15900 | 94 | temp_mapscr->enemy[k]+=1; | |
| 15901 | 94 | } | |
| 15902 | 221760 | } | |
| 15903 | |||
| 15904 |
2/2✓ Branch 0 taken 6434160 times.
✓ Branch 1 taken 5285040 times.
|
11719200 | if(version < 9) |
| 15905 | { | ||
| 15906 |
2/2✓ Branch 0 taken 5009135 times.
✓ Branch 1 taken 275905 times.
|
5285040 | if(temp_mapscr->enemy[k]>0) |
| 15907 | { | ||
| 15908 | 275905 | temp_mapscr->enemy[k]+=10; | |
| 15909 | 275905 | } | |
| 15910 | 5285040 | } | |
| 15911 | //don't read in any invalid data | ||
| 15912 |
2/2✓ Branch 0 taken 11718750 times.
✓ Branch 1 taken 450 times.
|
11719200 | if ( ((unsigned)temp_mapscr->enemy[k]) > MAXGUYS ) |
| 15913 | { | ||
| 15914 | 450 | al_trace("Tried to read an invalid enemy ID (%d) for enemy[%d]. This has been cleared to 0.\n", temp_mapscr->enemy[k], k); | |
| 15915 | 450 | temp_mapscr->enemy[k] = 0; | |
| 15916 | 450 | } | |
| 15917 | 11719200 | } | |
| 15918 | |||
| 15919 |
1/2✓ Branch 0 taken 1171920 times.
✗ Branch 1 not taken.
|
1171920 | if(!p_getc(&(temp_mapscr->pattern),f)) |
| 15920 | { | ||
| 15921 | ✗ | return qe_invalid; | |
| 15922 | } | ||
| 15923 | |||
| 15924 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1171920 times.
|
1171920 | if(!p_getc(&(temp_mapscr->sidewarptype[0]),f)) |
| 15925 | { | ||
| 15926 | ✗ | return qe_invalid; | |
| 15927 | } | ||
| 15928 | |||
| 15929 |
3/6✓ Branch 0 taken 528504 times.
✓ Branch 1 taken 643416 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 528504 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
1171920 | if((Header->zelda_version > 0x211)||((Header->zelda_version == 0x211)&&(Header->build>7))) |
| 15930 | { | ||
| 15931 |
2/2✓ Branch 0 taken 1930248 times.
✓ Branch 1 taken 643416 times.
|
2573664 | for(int32_t i=1; i<4; i++) |
| 15932 | { | ||
| 15933 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1930248 times.
|
1930248 | if(!p_getc(&(temp_mapscr->sidewarptype[i]),f)) |
| 15934 | { | ||
| 15935 | ✗ | return qe_invalid; | |
| 15936 | } | ||
| 15937 | 1930248 | } | |
| 15938 | 643416 | } | |
| 15939 | else | ||
| 15940 | { | ||
| 15941 | 528504 | temp_mapscr->sidewarptype[1]=0; | |
| 15942 | 528504 | temp_mapscr->sidewarptype[2]=0; | |
| 15943 | 528504 | temp_mapscr->sidewarptype[3]=0; | |
| 15944 | } | ||
| 15945 | |||
| 15946 |
2/2✓ Branch 0 taken 643416 times.
✓ Branch 1 taken 528504 times.
|
1171920 | if(version >= 15) |
| 15947 | { | ||
| 15948 |
1/2✓ Branch 0 taken 643416 times.
✗ Branch 1 not taken.
|
643416 | if(!p_getc(&(temp_mapscr->sidewarpoverlayflags),f)) |
| 15949 | { | ||
| 15950 | ✗ | return qe_invalid; | |
| 15951 | } | ||
| 15952 | 643416 | } | |
| 15953 | else | ||
| 15954 | { | ||
| 15955 | 528504 | temp_mapscr->sidewarpoverlayflags=0; | |
| 15956 | } | ||
| 15957 | |||
| 15958 |
1/2✓ Branch 0 taken 1171920 times.
✗ Branch 1 not taken.
|
1171920 | if(!p_getc(&(temp_mapscr->warparrivalx),f)) |
| 15959 | { | ||
| 15960 | ✗ | return qe_invalid; | |
| 15961 | } | ||
| 15962 | |||
| 15963 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1171920 times.
|
1171920 | if(!p_getc(&(temp_mapscr->warparrivaly),f)) |
| 15964 | { | ||
| 15965 | ✗ | return qe_invalid; | |
| 15966 | } | ||
| 15967 | |||
| 15968 |
2/2✓ Branch 0 taken 4687680 times.
✓ Branch 1 taken 1171920 times.
|
5859600 | for(int32_t k=0; k<4; k++) |
| 15969 | { | ||
| 15970 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4687680 times.
|
4687680 | if(!p_getc(&(temp_mapscr->path[k]),f)) |
| 15971 | { | ||
| 15972 | ✗ | return qe_invalid; | |
| 15973 | } | ||
| 15974 | 4687680 | } | |
| 15975 | |||
| 15976 |
1/2✓ Branch 0 taken 1171920 times.
✗ Branch 1 not taken.
|
1171920 | if(!p_getc(&(temp_mapscr->sidewarpscr[0]),f)) |
| 15977 | { | ||
| 15978 | ✗ | return qe_invalid; | |
| 15979 | } | ||
| 15980 | |||
| 15981 |
3/6✓ Branch 0 taken 528504 times.
✓ Branch 1 taken 643416 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 528504 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
1171920 | if((Header->zelda_version > 0x211)||((Header->zelda_version == 0x211)&&(Header->build>7))) |
| 15982 | { | ||
| 15983 |
2/2✓ Branch 0 taken 643416 times.
✓ Branch 1 taken 1930248 times.
|
2573664 | for(int32_t i=1; i<4; i++) |
| 15984 | { | ||
| 15985 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1930248 times.
|
1930248 | if(!p_getc(&(temp_mapscr->sidewarpscr[i]),f)) |
| 15986 | { | ||
| 15987 | ✗ | return qe_invalid; | |
| 15988 | } | ||
| 15989 | 1930248 | } | |
| 15990 | 643416 | } | |
| 15991 | else | ||
| 15992 | { | ||
| 15993 | 528504 | temp_mapscr->sidewarpscr[1]=0; | |
| 15994 | 528504 | temp_mapscr->sidewarpscr[2]=0; | |
| 15995 | 528504 | temp_mapscr->sidewarpscr[3]=0; | |
| 15996 | } | ||
| 15997 | |||
| 15998 |
2/2✓ Branch 0 taken 528504 times.
✓ Branch 1 taken 643416 times.
|
1171920 | if(version <= 11) |
| 15999 | { | ||
| 16000 |
1/2✓ Branch 0 taken 528504 times.
✗ Branch 1 not taken.
|
528504 | if(!p_getc(&(tempbyte),f)) |
| 16001 | { | ||
| 16002 | ✗ | return qe_invalid; | |
| 16003 | } | ||
| 16004 | |||
| 16005 | 528504 | temp_mapscr->sidewarpdmap[0]=(word)tempbyte; | |
| 16006 | |||
| 16007 |
2/6✓ Branch 0 taken 528504 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 528504 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
528504 | if((Header->zelda_version > 0x211)||((Header->zelda_version == 0x211)&&(Header->build>7))) |
| 16008 | { | ||
| 16009 | ✗ | for(int32_t i=1; i<4; i++) | |
| 16010 | { | ||
| 16011 | ✗ | if(!p_getc(&(tempbyte),f)) | |
| 16012 | { | ||
| 16013 | ✗ | return qe_invalid; | |
| 16014 | } | ||
| 16015 | |||
| 16016 | ✗ | temp_mapscr->sidewarpdmap[i]=(word)tempbyte; | |
| 16017 | ✗ | } | |
| 16018 | ✗ | } | |
| 16019 | else | ||
| 16020 | { | ||
| 16021 | 528504 | temp_mapscr->sidewarpdmap[1]=0; | |
| 16022 | 528504 | temp_mapscr->sidewarpdmap[2]=0; | |
| 16023 | 528504 | temp_mapscr->sidewarpdmap[3]=0; | |
| 16024 | } | ||
| 16025 | 528504 | } | |
| 16026 | else | ||
| 16027 | { | ||
| 16028 |
2/2✓ Branch 0 taken 2573664 times.
✓ Branch 1 taken 643416 times.
|
3217080 | for(int32_t i=0; i<4; i++) |
| 16029 | { | ||
| 16030 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2573664 times.
|
2573664 | if(!p_igetw(&(temp_mapscr->sidewarpdmap[i]),f)) |
| 16031 | { | ||
| 16032 | ✗ | return qe_invalid; | |
| 16033 | } | ||
| 16034 | 2573664 | } | |
| 16035 | } | ||
| 16036 | |||
| 16037 |
3/6✓ Branch 0 taken 528504 times.
✓ Branch 1 taken 643416 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 528504 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
1171920 | if((Header->zelda_version > 0x211)||((Header->zelda_version == 0x211)&&(Header->build>7))) |
| 16038 | { | ||
| 16039 |
1/2✓ Branch 0 taken 643416 times.
✗ Branch 1 not taken.
|
643416 | if(!p_getc(&(temp_mapscr->sidewarpindex),f)) |
| 16040 | { | ||
| 16041 | ✗ | return qe_invalid; | |
| 16042 | } | ||
| 16043 | 643416 | } | |
| 16044 | 528504 | else temp_mapscr->sidewarpindex = 0; | |
| 16045 | |||
| 16046 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1171920 times.
|
1171920 | if(!p_igetw(&(temp_mapscr->undercombo),f)) |
| 16047 | { | ||
| 16048 | ✗ | return qe_invalid; | |
| 16049 | } | ||
| 16050 | |||
| 16051 | 1171920 | byte old_combo_page = 0; | |
| 16052 |
2/2✓ Branch 0 taken 1147024 times.
✓ Branch 1 taken 24896 times.
|
1171920 | if(Header->zelda_version < 0x193) |
| 16053 | { | ||
| 16054 |
1/2✓ Branch 0 taken 24896 times.
✗ Branch 1 not taken.
|
24896 | if (!p_getc(&old_combo_page, f)) |
| 16055 | { | ||
| 16056 | ✗ | return qe_invalid; | |
| 16057 | } | ||
| 16058 | |||
| 16059 |
2/2✓ Branch 0 taken 272 times.
✓ Branch 1 taken 24624 times.
|
24896 | if (!should_skip) |
| 16060 | { | ||
| 16061 | 24624 | old_combo_pages[scrind] = old_combo_page; | |
| 16062 | 24624 | } | |
| 16063 | 24896 | } | |
| 16064 | |||
| 16065 |
1/2✓ Branch 0 taken 1171920 times.
✗ Branch 1 not taken.
|
1171920 | if(!p_getc(&(temp_mapscr->undercset),f)) //recalculated for older quests |
| 16066 | { | ||
| 16067 | ✗ | return qe_invalid; | |
| 16068 | } | ||
| 16069 | |||
| 16070 |
1/2✓ Branch 0 taken 1171920 times.
✗ Branch 1 not taken.
|
1171920 | if(!p_igetw(&(temp_mapscr->catchall),f)) |
| 16071 | { | ||
| 16072 | ✗ | return qe_invalid; | |
| 16073 | } | ||
| 16074 | |||
| 16075 |
1/2✓ Branch 0 taken 1171920 times.
✗ Branch 1 not taken.
|
1171920 | if(!p_getc(&(temp_mapscr->flags),f)) |
| 16076 | { | ||
| 16077 | ✗ | return qe_invalid; | |
| 16078 | } | ||
| 16079 | |||
| 16080 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1171920 times.
|
1171920 | if(!p_getc(&(temp_mapscr->flags2),f)) |
| 16081 | { | ||
| 16082 | ✗ | return qe_invalid; | |
| 16083 | } | ||
| 16084 | |||
| 16085 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1171920 times.
|
1171920 | if(!p_getc(&(temp_mapscr->flags3),f)) |
| 16086 | { | ||
| 16087 | ✗ | return qe_invalid; | |
| 16088 | } | ||
| 16089 | |||
| 16090 |
3/6✓ Branch 0 taken 528504 times.
✓ Branch 1 taken 643416 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 528504 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
1171920 | if((Header->zelda_version > 0x211)||((Header->zelda_version == 0x211)&&(Header->build>1))) |
| 16091 | //if (version>2) | ||
| 16092 | { | ||
| 16093 |
1/2✓ Branch 0 taken 643416 times.
✗ Branch 1 not taken.
|
643416 | if(!p_getc(&(temp_mapscr->flags4),f)) |
| 16094 | { | ||
| 16095 | ✗ | return qe_invalid; | |
| 16096 | } | ||
| 16097 | 643416 | } | |
| 16098 | |||
| 16099 |
3/6✓ Branch 0 taken 528504 times.
✓ Branch 1 taken 643416 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 528504 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
1171920 | if((Header->zelda_version > 0x211)||((Header->zelda_version == 0x211)&&(Header->build>7))) |
| 16100 | { | ||
| 16101 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 643416 times.
|
643416 | if(!p_getc(&(temp_mapscr->flags5),f)) |
| 16102 | { | ||
| 16103 | ✗ | return qe_invalid; | |
| 16104 | } | ||
| 16105 | |||
| 16106 |
1/2✓ Branch 0 taken 643416 times.
✗ Branch 1 not taken.
|
643416 | if(!p_igetw(&wpadding,f)) |
| 16107 | ✗ | return qe_invalid; | |
| 16108 | 643416 | temp_mapscr->noreset = wpadding | mLIGHTBEAM | mTMPNORET | mVISITED; | |
| 16109 |
1/2✓ Branch 0 taken 643416 times.
✗ Branch 1 not taken.
|
643416 | if(!p_igetw(&wpadding,f)) |
| 16110 | ✗ | return qe_invalid; | |
| 16111 | 1286832 | temp_mapscr->nocarry = wpadding | mLIGHTBEAM | mTMPNORET | mVISITED | | |
| 16112 | 643416 | mDOOR_UP | mDOOR_DOWN | mDOOR_LEFT | mDOOR_RIGHT | mNEVERRET | mNO_ENEMIES_RETURN; | |
| 16113 | |||
| 16114 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 643416 times.
|
643416 | if(temp_mapscr->flags5&32) |
| 16115 | { | ||
| 16116 | ✗ | temp_mapscr->flags5 &= ~32; | |
| 16117 | ✗ | temp_mapscr->noreset |= 48; | |
| 16118 | ✗ | } | |
| 16119 | |||
| 16120 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 643416 times.
|
643416 | if(version<8) |
| 16121 | { | ||
| 16122 | ✗ | if(temp_mapscr->noreset&1) | |
| 16123 | { | ||
| 16124 | ✗ | temp_mapscr->noreset|=8192; | |
| 16125 | ✗ | } | |
| 16126 | |||
| 16127 | ✗ | if(temp_mapscr->nocarry&1) | |
| 16128 | { | ||
| 16129 | ✗ | temp_mapscr->nocarry|=8192; | |
| 16130 | ✗ | temp_mapscr->nocarry&=~1; | |
| 16131 | ✗ | } | |
| 16132 | ✗ | } | |
| 16133 | 643416 | } | |
| 16134 | else | ||
| 16135 | { | ||
| 16136 | 528504 | temp_mapscr->flags5 = 0; | |
| 16137 | 528504 | temp_mapscr->noreset = mLIGHTBEAM | mTMPNORET | mVISITED; | |
| 16138 | 528504 | temp_mapscr->nocarry = mLIGHTBEAM | mTMPNORET | mVISITED | | |
| 16139 | mDOOR_UP | mDOOR_DOWN | mDOOR_LEFT | mDOOR_RIGHT | mNEVERRET | mNO_ENEMIES_RETURN; | ||
| 16140 | } | ||
| 16141 | |||
| 16142 |
3/6✓ Branch 0 taken 528504 times.
✓ Branch 1 taken 643416 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 528504 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
1171920 | if((Header->zelda_version > 0x211)||((Header->zelda_version == 0x211)&&(Header->build>9))) |
| 16143 | { | ||
| 16144 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 643416 times.
|
643416 | if(!p_getc(&(temp_mapscr->flags6),f)) |
| 16145 | { | ||
| 16146 | ✗ | return qe_invalid; | |
| 16147 | } | ||
| 16148 | 643416 | } | |
| 16149 | |||
| 16150 |
2/2✓ Branch 0 taken 643416 times.
✓ Branch 1 taken 528504 times.
|
1171920 | if(version>5) |
| 16151 | { | ||
| 16152 |
1/2✓ Branch 0 taken 643416 times.
✗ Branch 1 not taken.
|
643416 | if(!p_getc(&(temp_mapscr->flags7),f)) |
| 16153 | { | ||
| 16154 | ✗ | return qe_invalid; | |
| 16155 | } | ||
| 16156 | |||
| 16157 |
1/2✓ Branch 0 taken 643416 times.
✗ Branch 1 not taken.
|
643416 | if(!p_getc(&(temp_mapscr->flags8),f)) |
| 16158 | { | ||
| 16159 | ✗ | return qe_invalid; | |
| 16160 | } | ||
| 16161 | |||
| 16162 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 643416 times.
|
643416 | if(!p_getc(&(temp_mapscr->flags9),f)) |
| 16163 | { | ||
| 16164 | ✗ | return qe_invalid; | |
| 16165 | } | ||
| 16166 | |||
| 16167 |
1/2✓ Branch 0 taken 643416 times.
✗ Branch 1 not taken.
|
643416 | if(!p_getc(&(temp_mapscr->flags10),f)) |
| 16168 | { | ||
| 16169 | ✗ | return qe_invalid; | |
| 16170 | } | ||
| 16171 | |||
| 16172 |
1/2✓ Branch 0 taken 643416 times.
✗ Branch 1 not taken.
|
643416 | if(!p_getc(&(temp_mapscr->csensitive),f)) |
| 16173 | { | ||
| 16174 | ✗ | return qe_invalid; | |
| 16175 | } | ||
| 16176 | 643416 | } | |
| 16177 | else | ||
| 16178 | { | ||
| 16179 | 528504 | temp_mapscr->csensitive=1; | |
| 16180 | } | ||
| 16181 | |||
| 16182 |
2/2✓ Branch 0 taken 528504 times.
✓ Branch 1 taken 643416 times.
|
1171920 | if(version<14) // August 2007: screen SFX added |
| 16183 | { | ||
| 16184 |
2/2✓ Branch 0 taken 527510 times.
✓ Branch 1 taken 994 times.
|
528504 | if(temp_mapscr->flags&8) //fROAR |
| 16185 | { | ||
| 16186 | 994 | temp_mapscr->bosssfx= | |
| 16187 |
2/2✓ Branch 0 taken 141 times.
✓ Branch 1 taken 853 times.
|
994 | (temp_mapscr->flags3&2) ? WAV_DODONGO : // fDODONGO |
| 16188 | 853 | (temp_mapscr->flags2&32) ? WAV_VADER : // fVADER | |
| 16189 | WAV_ROAR; | ||
| 16190 | 994 | } | |
| 16191 | |||
| 16192 |
2/2✓ Branch 0 taken 170 times.
✓ Branch 1 taken 528334 times.
|
528504 | if(temp_mapscr->flags&128) //fSEA_SFX |
| 16193 | { | ||
| 16194 | 170 | temp_mapscr->oceansfx=WAV_SEA; | |
| 16195 | 170 | } | |
| 16196 | |||
| 16197 | 528504 | temp_mapscr->secretsfx = (temp_mapscr->flags3&64) //fNOSECRETSOUND | |
| 16198 | ? 0 : WAV_SECRET; | ||
| 16199 | |||
| 16200 | 528504 | temp_mapscr->flags3 &= ~66; //64|2 | |
| 16201 | 528504 | temp_mapscr->flags2 &= ~32; | |
| 16202 | 528504 | temp_mapscr->flags &= ~136; // 128|8 | |
| 16203 | 528504 | } | |
| 16204 | else | ||
| 16205 | { | ||
| 16206 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 643416 times.
|
643416 | if(!p_getc(&(temp_mapscr->oceansfx),f)) |
| 16207 | { | ||
| 16208 | ✗ | return qe_invalid; | |
| 16209 | } | ||
| 16210 | |||
| 16211 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 643416 times.
|
643416 | if(!p_getc(&(temp_mapscr->bosssfx),f)) |
| 16212 | { | ||
| 16213 | ✗ | return qe_invalid; | |
| 16214 | } | ||
| 16215 | |||
| 16216 |
1/2✓ Branch 0 taken 643416 times.
✗ Branch 1 not taken.
|
643416 | if(!p_getc(&(temp_mapscr->secretsfx),f)) |
| 16217 | { | ||
| 16218 | ✗ | return qe_invalid; | |
| 16219 | } | ||
| 16220 | } | ||
| 16221 | |||
| 16222 |
2/2✓ Branch 0 taken 528504 times.
✓ Branch 1 taken 643416 times.
|
1171920 | if(version<15) // October 2007: another SFX |
| 16223 | { | ||
| 16224 | 528504 | temp_mapscr->holdupsfx=WAV_PICKUP; | |
| 16225 | 528504 | } | |
| 16226 | else | ||
| 16227 | { | ||
| 16228 |
1/2✓ Branch 0 taken 643416 times.
✗ Branch 1 not taken.
|
643416 | if(!p_getc(&(temp_mapscr->holdupsfx),f)) |
| 16229 | { | ||
| 16230 | ✗ | return qe_invalid; | |
| 16231 | } | ||
| 16232 | } | ||
| 16233 | |||
| 16234 | |||
| 16235 |
5/6✓ Branch 0 taken 24896 times.
✓ Branch 1 taken 1147024 times.
✓ Branch 2 taken 2720 times.
✓ Branch 3 taken 22176 times.
✓ Branch 4 taken 2720 times.
✗ Branch 5 not taken.
|
1171920 | if((Header->zelda_version > 0x192)||((Header->zelda_version == 0x192)&&(Header->build>97))) |
| 16236 | { | ||
| 16237 |
2/2✓ Branch 0 taken 6898464 times.
✓ Branch 1 taken 1149744 times.
|
8048208 | for(int32_t k=0; k<6; k++) |
| 16238 | { | ||
| 16239 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 6898464 times.
|
6898464 | if(!p_getc(&(temp_mapscr->layermap[k]),f)) |
| 16240 | { | ||
| 16241 | ✗ | return qe_invalid; | |
| 16242 | } | ||
| 16243 | 6898464 | } | |
| 16244 | |||
| 16245 |
2/2✓ Branch 0 taken 1149744 times.
✓ Branch 1 taken 6898464 times.
|
8048208 | for(int32_t k=0; k<6; k++) |
| 16246 | { | ||
| 16247 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 6898464 times.
|
6898464 | if(!p_getc(&(temp_mapscr->layerscreen[k]),f)) |
| 16248 | { | ||
| 16249 | ✗ | return qe_invalid; | |
| 16250 | } | ||
| 16251 | 6898464 | } | |
| 16252 | 1149744 | } | |
| 16253 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 22176 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
22176 | else if((Header->zelda_version == 0x192)&&(Header->build>23)&&(Header->build<98)) |
| 16254 | { | ||
| 16255 | ✗ | if(!p_getc(&(temp_mapscr->layermap[2]),f)) | |
| 16256 | { | ||
| 16257 | ✗ | return qe_invalid; | |
| 16258 | } | ||
| 16259 | |||
| 16260 | ✗ | if(!p_getc(&(temp_mapscr->layerscreen[2]),f)) | |
| 16261 | { | ||
| 16262 | ✗ | return qe_invalid; | |
| 16263 | } | ||
| 16264 | |||
| 16265 | ✗ | if(!p_getc(&(temp_mapscr->layermap[4]),f)) | |
| 16266 | { | ||
| 16267 | ✗ | return qe_invalid; | |
| 16268 | } | ||
| 16269 | |||
| 16270 | ✗ | if(!p_getc(&(temp_mapscr->layerscreen[4]),f)) | |
| 16271 | |||
| 16272 | { | ||
| 16273 | ✗ | return qe_invalid; | |
| 16274 | } | ||
| 16275 | ✗ | } | |
| 16276 | |||
| 16277 |
3/4✓ Branch 0 taken 2720 times.
✓ Branch 1 taken 1169200 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 2720 times.
|
1171920 | if((Header->zelda_version == 0x192)&&(Header->build>149)) |
| 16278 | { | ||
| 16279 |
2/2✓ Branch 0 taken 16320 times.
✓ Branch 1 taken 2720 times.
|
19040 | for(int32_t k=0; k<6; k++) |
| 16280 | { | ||
| 16281 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 16320 times.
|
16320 | if(!p_getc(&tempbyte,f)) //layerxsize |
| 16282 | { | ||
| 16283 | ✗ | return qe_invalid; | |
| 16284 | } | ||
| 16285 | 16320 | } | |
| 16286 | |||
| 16287 |
2/2✓ Branch 0 taken 16320 times.
✓ Branch 1 taken 2720 times.
|
19040 | for(int32_t k=0; k<6; k++) |
| 16288 | { | ||
| 16289 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 16320 times.
|
16320 | if(!p_getc(&tempbyte,f)) //layerxspeed |
| 16290 | { | ||
| 16291 | ✗ | return qe_invalid; | |
| 16292 | } | ||
| 16293 | 16320 | } | |
| 16294 | |||
| 16295 |
2/2✓ Branch 0 taken 16320 times.
✓ Branch 1 taken 2720 times.
|
19040 | for(int32_t k=0; k<6; k++) |
| 16296 | { | ||
| 16297 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 16320 times.
|
16320 | if(!p_getc(&tempbyte,f)) //layerxdelay |
| 16298 | { | ||
| 16299 | ✗ | return qe_invalid; | |
| 16300 | } | ||
| 16301 | 16320 | } | |
| 16302 | |||
| 16303 |
2/2✓ Branch 0 taken 16320 times.
✓ Branch 1 taken 2720 times.
|
19040 | for(int32_t k=0; k<6; k++) |
| 16304 | { | ||
| 16305 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 16320 times.
|
16320 | if(!p_getc(&tempbyte,f)) //layerysize |
| 16306 | { | ||
| 16307 | ✗ | return qe_invalid; | |
| 16308 | } | ||
| 16309 | 16320 | } | |
| 16310 | |||
| 16311 |
2/2✓ Branch 0 taken 16320 times.
✓ Branch 1 taken 2720 times.
|
19040 | for(int32_t k=0; k<6; k++) |
| 16312 | { | ||
| 16313 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 16320 times.
|
16320 | if(!p_getc(&tempbyte,f)) //layeryspeed |
| 16314 | { | ||
| 16315 | ✗ | return qe_invalid; | |
| 16316 | } | ||
| 16317 | 16320 | } | |
| 16318 | |||
| 16319 |
2/2✓ Branch 0 taken 2720 times.
✓ Branch 1 taken 16320 times.
|
19040 | for(int32_t k=0; k<6; k++) |
| 16320 | { | ||
| 16321 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 16320 times.
|
16320 | if(!p_getc(&tempbyte,f)) //layerydelay |
| 16322 | { | ||
| 16323 | ✗ | return qe_invalid; | |
| 16324 | } | ||
| 16325 | 16320 | } | |
| 16326 | 2720 | } | |
| 16327 | |||
| 16328 |
5/6✓ Branch 0 taken 24896 times.
✓ Branch 1 taken 1147024 times.
✓ Branch 2 taken 2720 times.
✓ Branch 3 taken 22176 times.
✓ Branch 4 taken 2720 times.
✗ Branch 5 not taken.
|
1171920 | if((Header->zelda_version > 0x192)||((Header->zelda_version == 0x192)&&(Header->build>149))) |
| 16329 | { | ||
| 16330 |
2/2✓ Branch 0 taken 6898464 times.
✓ Branch 1 taken 1149744 times.
|
8048208 | for(int32_t k=0; k<6; k++) |
| 16331 | { | ||
| 16332 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 6898464 times.
|
6898464 | if(!p_getc(&(temp_mapscr->layeropacity[k]),f)) |
| 16333 | { | ||
| 16334 | ✗ | return qe_invalid; | |
| 16335 | } | ||
| 16336 | 6898464 | } | |
| 16337 | 1149744 | } | |
| 16338 | |||
| 16339 |
5/6✓ Branch 0 taken 24896 times.
✓ Branch 1 taken 1147024 times.
✓ Branch 2 taken 2720 times.
✓ Branch 3 taken 22176 times.
✓ Branch 4 taken 2720 times.
✗ Branch 5 not taken.
|
1171920 | if((Header->zelda_version > 0x192)||((Header->zelda_version == 0x192)&&(Header->build>153))) |
| 16340 | { | ||
| 16341 |
3/4✓ Branch 0 taken 2720 times.
✓ Branch 1 taken 1147024 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 2720 times.
|
1149744 | if((Header->zelda_version == 0x192)&&(Header->build>153)) |
| 16342 | { | ||
| 16343 |
1/2✓ Branch 0 taken 2720 times.
✗ Branch 1 not taken.
|
2720 | if(!p_getc(&padding,f)) |
| 16344 | { | ||
| 16345 | ✗ | return qe_invalid; | |
| 16346 | } | ||
| 16347 | 2720 | } | |
| 16348 | |||
| 16349 |
1/2✓ Branch 0 taken 1149744 times.
✗ Branch 1 not taken.
|
1149744 | if(!p_igetw(&(temp_mapscr->timedwarptics),f)) |
| 16350 | { | ||
| 16351 | ✗ | return qe_invalid; | |
| 16352 | } | ||
| 16353 | 1149744 | } | |
| 16354 | |||
| 16355 |
5/6✓ Branch 0 taken 1149744 times.
✓ Branch 1 taken 22176 times.
✓ Branch 2 taken 2720 times.
✓ Branch 3 taken 1147024 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 2720 times.
|
1171920 | if((Header->zelda_version < 0x192)||((Header->zelda_version == 0x192)&&(Header->build<24))) |
| 16356 | { | ||
| 16357 | 22176 | extras=15; | |
| 16358 | 22176 | } | |
| 16359 |
3/4✓ Branch 0 taken 2720 times.
✓ Branch 1 taken 1147024 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 2720 times.
|
1149744 | else if(((Header->zelda_version == 0x192)&&(Header->build<98))) |
| 16360 | { | ||
| 16361 | ✗ | extras=11; | |
| 16362 | ✗ | } | |
| 16363 |
3/4✓ Branch 0 taken 2720 times.
✓ Branch 1 taken 1147024 times.
✓ Branch 2 taken 2720 times.
✗ Branch 3 not taken.
|
1149744 | else if((Header->zelda_version == 0x192)&&(Header->build<150)) |
| 16364 | { | ||
| 16365 | ✗ | extras=32; | |
| 16366 | ✗ | } | |
| 16367 |
3/4✓ Branch 0 taken 2720 times.
✓ Branch 1 taken 1147024 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 2720 times.
|
1149744 | else if((Header->zelda_version == 0x192)&&(Header->build<154)) |
| 16368 | { | ||
| 16369 | ✗ | extras=64; | |
| 16370 | ✗ | } | |
| 16371 |
2/2✓ Branch 0 taken 2720 times.
✓ Branch 1 taken 1147024 times.
|
1149744 | else if(Header->zelda_version < 0x193) |
| 16372 | { | ||
| 16373 | 2720 | extras=62; | |
| 16374 | 2720 | } | |
| 16375 | else | ||
| 16376 | |||
| 16377 | { | ||
| 16378 | 1147024 | extras=0; | |
| 16379 | } | ||
| 16380 | |||
| 16381 |
2/2✓ Branch 0 taken 501280 times.
✓ Branch 1 taken 1171920 times.
|
1673200 | for(int32_t k=0; k<extras; k++) |
| 16382 | { | ||
| 16383 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 501280 times.
|
501280 | if(!p_getc(&tempbyte,f)) //extra[k] |
| 16384 | { | ||
| 16385 | ✗ | return qe_invalid; | |
| 16386 | } | ||
| 16387 | 501280 | } | |
| 16388 | |||
| 16389 |
3/6✓ Branch 0 taken 528504 times.
✓ Branch 1 taken 643416 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 528504 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
1171920 | if((Header->zelda_version > 0x211)||((Header->zelda_version == 0x211)&&(Header->build>2))) |
| 16390 | //if (version>3) | ||
| 16391 | { | ||
| 16392 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 643416 times.
|
643416 | if(!p_getc(&(temp_mapscr->nextmap),f)) |
| 16393 | { | ||
| 16394 | ✗ | return qe_invalid; | |
| 16395 | } | ||
| 16396 | |||
| 16397 |
1/2✓ Branch 0 taken 643416 times.
✗ Branch 1 not taken.
|
643416 | if(!p_getc(&(temp_mapscr->nextscr),f)) |
| 16398 | { | ||
| 16399 | ✗ | return qe_invalid; | |
| 16400 | } | ||
| 16401 | 643416 | } | |
| 16402 | else | ||
| 16403 | { | ||
| 16404 | 528504 | temp_mapscr->nextmap=0; | |
| 16405 | 528504 | temp_mapscr->nextscr=0; | |
| 16406 | } | ||
| 16407 | |||
| 16408 |
5/6✓ Branch 0 taken 1149744 times.
✓ Branch 1 taken 22176 times.
✓ Branch 2 taken 2720 times.
✓ Branch 3 taken 1147024 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 2720 times.
|
1171920 | if((Header->zelda_version < 0x192)||((Header->zelda_version == 0x192)&&(Header->build<137))) |
| 16409 | { | ||
| 16410 | 22176 | secretcombos=20; | |
| 16411 | 22176 | } | |
| 16412 |
3/4✓ Branch 0 taken 2720 times.
✓ Branch 1 taken 1147024 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 2720 times.
|
1149744 | else if((Header->zelda_version == 0x192)&&(Header->build<154)) |
| 16413 | { | ||
| 16414 | ✗ | secretcombos=256; | |
| 16415 | ✗ | } | |
| 16416 | else | ||
| 16417 | { | ||
| 16418 | 1149744 | secretcombos=128; | |
| 16419 | } | ||
| 16420 | |||
| 16421 |
5/6✓ Branch 0 taken 1149744 times.
✓ Branch 1 taken 22176 times.
✓ Branch 2 taken 2720 times.
✓ Branch 3 taken 1147024 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 2720 times.
|
1171920 | if((Header->zelda_version < 0x192)||((Header->zelda_version == 0x192)&&(Header->build<154))) |
| 16422 | { | ||
| 16423 |
2/2✓ Branch 0 taken 443520 times.
✓ Branch 1 taken 22176 times.
|
465696 | for(int32_t k=0; k<secretcombos; k++) |
| 16424 | { | ||
| 16425 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 443520 times.
|
443520 | if(!p_getc(&tempbyte,f)) |
| 16426 | { | ||
| 16427 | ✗ | return qe_invalid; | |
| 16428 | } | ||
| 16429 | |||
| 16430 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 443520 times.
|
443520 | if(k<128) |
| 16431 | { | ||
| 16432 | 443520 | temp_mapscr->secretcombo[k]=tempbyte; | |
| 16433 | 443520 | } | |
| 16434 | 443520 | } | |
| 16435 | 22176 | } | |
| 16436 | else | ||
| 16437 | { | ||
| 16438 |
2/2✓ Branch 0 taken 147167232 times.
✓ Branch 1 taken 1149744 times.
|
148316976 | for(int32_t k=0; k<128; k++) |
| 16439 | { | ||
| 16440 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 147167232 times.
|
147167232 | if(!p_igetw(&(temp_mapscr->secretcombo[k]),f)) |
| 16441 | { | ||
| 16442 | ✗ | return qe_invalid; | |
| 16443 | } | ||
| 16444 | |||
| 16445 | 147167232 | } | |
| 16446 | } | ||
| 16447 | |||
| 16448 |
5/6✓ Branch 0 taken 24896 times.
✓ Branch 1 taken 1147024 times.
✓ Branch 2 taken 2720 times.
✓ Branch 3 taken 22176 times.
✓ Branch 4 taken 2720 times.
✗ Branch 5 not taken.
|
1171920 | if((Header->zelda_version > 0x192)||((Header->zelda_version == 0x192)&&(Header->build>153))) |
| 16449 | { | ||
| 16450 |
2/2✓ Branch 0 taken 147167232 times.
✓ Branch 1 taken 1149744 times.
|
148316976 | for(int32_t k=0; k<128; k++) |
| 16451 | { | ||
| 16452 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 147167232 times.
|
147167232 | if(!p_getc(&(temp_mapscr->secretcset[k]),f)) |
| 16453 | { | ||
| 16454 | ✗ | return qe_invalid; | |
| 16455 | } | ||
| 16456 | 147167232 | } | |
| 16457 | |||
| 16458 |
2/2✓ Branch 0 taken 147167232 times.
✓ Branch 1 taken 1149744 times.
|
148316976 | for(int32_t k=0; k<128; k++) |
| 16459 | { | ||
| 16460 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 147167232 times.
|
147167232 | if(!p_getc(&(temp_mapscr->secretflag[k]),f)) |
| 16461 | { | ||
| 16462 | ✗ | return qe_invalid; | |
| 16463 | } | ||
| 16464 | 147167232 | } | |
| 16465 | 1149744 | } | |
| 16466 | |||
| 16467 |
4/6✓ Branch 0 taken 2720 times.
✓ Branch 1 taken 1169200 times.
✓ Branch 2 taken 2720 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 2720 times.
✗ Branch 5 not taken.
|
1171920 | if((Header->zelda_version == 0x192)&&(Header->build>97)&&(Header->build<154)) |
| 16468 | { | ||
| 16469 | ✗ | if(!p_getc(&padding,f)) | |
| 16470 | { | ||
| 16471 | ✗ | return qe_invalid; | |
| 16472 | } | ||
| 16473 | ✗ | } | |
| 16474 | |||
| 16475 |
2/2✓ Branch 0 taken 206257920 times.
✓ Branch 1 taken 1171920 times.
|
207429840 | for(int32_t k=0; k<176; k++) |
| 16476 | { | ||
| 16477 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 206257920 times.
|
206257920 | if(!p_igetw(&(temp_mapscr->data[k]),f)) |
| 16478 | { | ||
| 16479 | ✗ | return qe_invalid; | |
| 16480 | } | ||
| 16481 | 206257920 | } | |
| 16482 | |||
| 16483 |
4/6✓ Branch 0 taken 2720 times.
✓ Branch 1 taken 1169200 times.
✓ Branch 2 taken 2720 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 2720 times.
✗ Branch 5 not taken.
|
1171920 | if((Header->zelda_version == 0x192)&&(Header->build>20)&&(Header->build<24)) |
| 16484 | { | ||
| 16485 | ✗ | if(!p_getc(&padding,f)) | |
| 16486 | { | ||
| 16487 | ✗ | return qe_invalid; | |
| 16488 | } | ||
| 16489 | |||
| 16490 | ✗ | if(!p_getc(&padding,f)) | |
| 16491 | { | ||
| 16492 | ✗ | return qe_invalid; | |
| 16493 | } | ||
| 16494 | ✗ | } | |
| 16495 | |||
| 16496 |
5/6✓ Branch 0 taken 24896 times.
✓ Branch 1 taken 1147024 times.
✓ Branch 2 taken 2720 times.
✓ Branch 3 taken 22176 times.
✓ Branch 4 taken 2720 times.
✗ Branch 5 not taken.
|
1171920 | if((Header->zelda_version > 0x192)||((Header->zelda_version == 0x192)&&(Header->build>20))) |
| 16497 | { | ||
| 16498 |
2/2✓ Branch 0 taken 202354944 times.
✓ Branch 1 taken 1149744 times.
|
203504688 | for(int32_t k=0; k<176; k++) |
| 16499 | { | ||
| 16500 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 202354944 times.
|
202354944 | if(!p_getc(&(temp_mapscr->sflag[k]),f)) |
| 16501 | { | ||
| 16502 | ✗ | return qe_invalid; | |
| 16503 | } | ||
| 16504 | |||
| 16505 |
3/4✓ Branch 0 taken 478720 times.
✓ Branch 1 taken 201876224 times.
✓ Branch 2 taken 478720 times.
✗ Branch 3 not taken.
|
202354944 | if((Header->zelda_version == 0x192)&&(Header->build<24)) |
| 16506 | { | ||
| 16507 | ✗ | if(!p_getc(&tempbyte,f)) | |
| 16508 | { | ||
| 16509 | ✗ | return qe_invalid; | |
| 16510 | } | ||
| 16511 | |||
| 16512 | ✗ | if(!p_getc(&tempbyte,f)) | |
| 16513 | { | ||
| 16514 | ✗ | return qe_invalid; | |
| 16515 | } | ||
| 16516 | |||
| 16517 | ✗ | if(!p_getc(&tempbyte,f)) | |
| 16518 | { | ||
| 16519 | ✗ | return qe_invalid; | |
| 16520 | } | ||
| 16521 | ✗ | } | |
| 16522 | 202354944 | } | |
| 16523 | 1149744 | } | |
| 16524 | |||
| 16525 |
5/6✓ Branch 0 taken 24896 times.
✓ Branch 1 taken 1147024 times.
✓ Branch 2 taken 2720 times.
✓ Branch 3 taken 22176 times.
✓ Branch 4 taken 2720 times.
✗ Branch 5 not taken.
|
1171920 | if((Header->zelda_version > 0x192)||((Header->zelda_version == 0x192)&&(Header->build>97))) |
| 16526 | { | ||
| 16527 |
2/2✓ Branch 0 taken 1149744 times.
✓ Branch 1 taken 202354944 times.
|
203504688 | for(int32_t k=0; k<176; k++) |
| 16528 | { | ||
| 16529 | |||
| 16530 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 202354944 times.
|
202354944 | if(!p_getc(&(temp_mapscr->cset[k]),f)) |
| 16531 | { | ||
| 16532 | ✗ | return qe_invalid; | |
| 16533 | } | ||
| 16534 | 202354944 | } | |
| 16535 | 1149744 | } | |
| 16536 | |||
| 16537 |
5/6✓ Branch 0 taken 1149744 times.
✓ Branch 1 taken 22176 times.
✓ Branch 2 taken 2720 times.
✓ Branch 3 taken 1147024 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 2720 times.
|
1171920 | if((Header->zelda_version < 0x192)||((Header->zelda_version == 0x192)&&(Header->build<154))) |
| 16538 | { | ||
| 16539 | 22176 | temp_mapscr->undercset=(temp_mapscr->undercombo>>8)&7; | |
| 16540 | 22176 | temp_mapscr->undercombo=(temp_mapscr->undercombo&0xFF)+(old_combo_page<<8); | |
| 16541 | 22176 | } | |
| 16542 | |||
| 16543 |
5/6✓ Branch 0 taken 1149744 times.
✓ Branch 1 taken 22176 times.
✓ Branch 2 taken 2720 times.
✓ Branch 3 taken 1147024 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 2720 times.
|
1171920 | if((Header->zelda_version < 0x192)||((Header->zelda_version == 0x192)&&(Header->build<137))) |
| 16544 | { | ||
| 16545 | 22176 | temp_mapscr->secretcombo[sSBOMB]=temp_mapscr->secretcombo[sBOMB]; | |
| 16546 | 22176 | temp_mapscr->secretcombo[sRCANDLE]=temp_mapscr->secretcombo[sBCANDLE]; | |
| 16547 | 22176 | temp_mapscr->secretcombo[sWANDFIRE]=temp_mapscr->secretcombo[sBCANDLE]; | |
| 16548 | 22176 | temp_mapscr->secretcombo[sDIVINEFIRE]=temp_mapscr->secretcombo[sBCANDLE]; | |
| 16549 | 22176 | temp_mapscr->secretcombo[sSARROW]=temp_mapscr->secretcombo[sARROW]; | |
| 16550 | 22176 | temp_mapscr->secretcombo[sGARROW]=temp_mapscr->secretcombo[sARROW]; | |
| 16551 | 22176 | } | |
| 16552 | |||
| 16553 |
5/6✓ Branch 0 taken 1149744 times.
✓ Branch 1 taken 22176 times.
✓ Branch 2 taken 2720 times.
✓ Branch 3 taken 1147024 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 2720 times.
|
1171920 | if((Header->zelda_version < 0x192)||((Header->zelda_version == 0x192)&&(Header->build<154))) |
| 16554 | { | ||
| 16555 |
2/2✓ Branch 0 taken 3902976 times.
✓ Branch 1 taken 22176 times.
|
3925152 | for(int32_t k=0; k<176; k++) |
| 16556 | { | ||
| 16557 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 3902976 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
3902976 | if((Header->zelda_version == 0x192)&&(Header->build>149)) |
| 16558 | { | ||
| 16559 | ✗ | if((Header->zelda_version == 0x192)&&(Header->build!=153)) | |
| 16560 | { | ||
| 16561 | ✗ | temp_mapscr->cset[k]=((temp_mapscr->data[k]>>8)&7); | |
| 16562 | ✗ | } | |
| 16563 | ✗ | } | |
| 16564 | else | ||
| 16565 | { | ||
| 16566 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 3902976 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
3902976 | if((Header->zelda_version < 0x192)|| |
| 16567 | ✗ | ((Header->zelda_version == 0x192)&&(Header->build<21))) | |
| 16568 | { | ||
| 16569 | 3902976 | temp_mapscr->sflag[k]=(temp_mapscr->data[k]>>11); | |
| 16570 | 3902976 | } | |
| 16571 | |||
| 16572 | 3902976 | temp_mapscr->cset[k]=((temp_mapscr->data[k]>>8)&7); | |
| 16573 | } | ||
| 16574 | |||
| 16575 | 3902976 | temp_mapscr->data[k]=(temp_mapscr->data[k]&0xFF)+(old_combo_page<<8); | |
| 16576 | 3902976 | } | |
| 16577 | 22176 | } | |
| 16578 | |||
| 16579 | /*if(version>12) | ||
| 16580 | { | ||
| 16581 | if(!p_getc(&(temp_mapscr->scrWidth),f)) | ||
| 16582 | { | ||
| 16583 | return qe_invalid; | ||
| 16584 | } | ||
| 16585 | if(!p_getc(&(temp_mapscr->scrHeight),f)) | ||
| 16586 | { | ||
| 16587 | return qe_invalid; | ||
| 16588 | } | ||
| 16589 | }*/ | ||
| 16590 | |||
| 16591 |
2/2✓ Branch 0 taken 643416 times.
✓ Branch 1 taken 528504 times.
|
1171920 | if(version>4) |
| 16592 | { | ||
| 16593 |
1/2✓ Branch 0 taken 643416 times.
✗ Branch 1 not taken.
|
643416 | if(!p_igetw(&(temp_mapscr->screen_midi),f)) |
| 16594 | { | ||
| 16595 | ✗ | return qe_invalid; | |
| 16596 | } | ||
| 16597 | 643416 | } | |
| 16598 | else | ||
| 16599 | { | ||
| 16600 | 528504 | temp_mapscr->screen_midi = -1; | |
| 16601 | } | ||
| 16602 | |||
| 16603 |
2/2✓ Branch 0 taken 643416 times.
✓ Branch 1 taken 528504 times.
|
1171920 | if(version>=17) |
| 16604 | { | ||
| 16605 |
1/2✓ Branch 0 taken 643416 times.
✗ Branch 1 not taken.
|
643416 | if(!p_getc(&(temp_mapscr->lens_layer),f)) |
| 16606 | { | ||
| 16607 | ✗ | return qe_invalid; | |
| 16608 | } | ||
| 16609 | 643416 | } | |
| 16610 | else | ||
| 16611 | { | ||
| 16612 | 528504 | temp_mapscr->lens_layer = llNORMAL; | |
| 16613 | } | ||
| 16614 | |||
| 16615 |
2/2✓ Branch 0 taken 528504 times.
✓ Branch 1 taken 643416 times.
|
1171920 | if(version>6) |
| 16616 | { | ||
| 16617 | dword bits; | ||
| 16618 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 643416 times.
|
643416 | if(!p_igetl(&bits,f)) |
| 16619 | { | ||
| 16620 | ✗ | return qe_invalid; | |
| 16621 | } | ||
| 16622 | |||
| 16623 | int32_t m; | ||
| 16624 | float tempfloat; | ||
| 16625 | word tempw; | ||
| 16626 | 643416 | temp_mapscr->ffcCountMarkDirty(); | |
| 16627 | 643416 | temp_mapscr->ffcs.clear(); | |
| 16628 | 643416 | temp_mapscr->resizeFFC(std::bit_width(bits)); | |
| 16629 |
2/2✓ Branch 0 taken 643416 times.
✓ Branch 1 taken 20589312 times.
|
21232728 | for(m=0; m<32; m++) |
| 16630 | { | ||
| 16631 |
2/2✓ Branch 0 taken 20316524 times.
✓ Branch 1 taken 272788 times.
|
20589312 | if((bits>>m)&1) |
| 16632 | { | ||
| 16633 | 272788 | ffcdata& tempffc = temp_mapscr->ffcs[m]; | |
| 16634 |
1/2✓ Branch 0 taken 272788 times.
✗ Branch 1 not taken.
|
272788 | if(!p_igetw(&tempw,f)) |
| 16635 | { | ||
| 16636 | ✗ | return qe_invalid; | |
| 16637 | } | ||
| 16638 | 272788 | tempffc.data = tempw; | |
| 16639 | |||
| 16640 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 272788 times.
|
272788 | if(!p_getc(&(tempffc.cset),f)) |
| 16641 | { | ||
| 16642 | ✗ | return qe_invalid; | |
| 16643 | } | ||
| 16644 | |||
| 16645 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 272788 times.
|
272788 | if(!p_igetw(&(tempffc.delay),f)) |
| 16646 | { | ||
| 16647 | ✗ | return qe_invalid; | |
| 16648 | } | ||
| 16649 | |||
| 16650 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 272788 times.
|
272788 | if(version < 9) |
| 16651 | { | ||
| 16652 | ✗ | if(!p_igetf_DO_NOT_USE(&tempfloat,f)) | |
| 16653 | { | ||
| 16654 | ✗ | return qe_invalid; | |
| 16655 | } | ||
| 16656 | |||
| 16657 | ✗ | tempffc.x=zslongToFix(int32_t(tempfloat*10000)); | |
| 16658 | |||
| 16659 | ✗ | if(!p_igetf_DO_NOT_USE(&tempfloat,f)) | |
| 16660 | { | ||
| 16661 | ✗ | return qe_invalid; | |
| 16662 | } | ||
| 16663 | |||
| 16664 | ✗ | tempffc.y=zslongToFix(int32_t(tempfloat*10000)); | |
| 16665 | |||
| 16666 | ✗ | if(!p_igetf_DO_NOT_USE(&tempfloat,f)) | |
| 16667 | { | ||
| 16668 | ✗ | return qe_invalid; | |
| 16669 | } | ||
| 16670 | |||
| 16671 | ✗ | tempffc.vx=zslongToFix(int32_t(tempfloat*10000)); | |
| 16672 | |||
| 16673 | ✗ | if(!p_igetf_DO_NOT_USE(&tempfloat,f)) | |
| 16674 | { | ||
| 16675 | ✗ | return qe_invalid; | |
| 16676 | } | ||
| 16677 | |||
| 16678 | ✗ | tempffc.vy=zslongToFix(int32_t(tempfloat*10000)); | |
| 16679 | |||
| 16680 | ✗ | if(!p_igetf_DO_NOT_USE(&tempfloat,f)) | |
| 16681 | { | ||
| 16682 | ✗ | return qe_invalid; | |
| 16683 | } | ||
| 16684 | |||
| 16685 | ✗ | tempffc.ax=zslongToFix(int32_t(tempfloat*10000)); | |
| 16686 | |||
| 16687 | ✗ | if(!p_igetf_DO_NOT_USE(&tempfloat,f)) | |
| 16688 | { | ||
| 16689 | ✗ | return qe_invalid; | |
| 16690 | } | ||
| 16691 | |||
| 16692 | ✗ | tempffc.ay=zslongToFix(int32_t(tempfloat*10000)); | |
| 16693 | ✗ | } | |
| 16694 | else | ||
| 16695 | { | ||
| 16696 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 272788 times.
|
272788 | if(!p_igetzf(&(tempffc.x),f)) |
| 16697 | { | ||
| 16698 | ✗ | return qe_invalid; | |
| 16699 | } | ||
| 16700 | |||
| 16701 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 272788 times.
|
272788 | if(!p_igetzf(&(tempffc.y),f)) |
| 16702 | { | ||
| 16703 | ✗ | return qe_invalid; | |
| 16704 | } | ||
| 16705 | |||
| 16706 |
1/2✓ Branch 0 taken 272788 times.
✗ Branch 1 not taken.
|
272788 | if(!p_igetzf(&(tempffc.vx),f)) |
| 16707 | { | ||
| 16708 | ✗ | return qe_invalid; | |
| 16709 | } | ||
| 16710 | |||
| 16711 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 272788 times.
|
272788 | if(!p_igetzf(&(tempffc.vy),f)) |
| 16712 | { | ||
| 16713 | ✗ | return qe_invalid; | |
| 16714 | } | ||
| 16715 | |||
| 16716 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 272788 times.
|
272788 | if(!p_igetzf(&(tempffc.ax),f)) |
| 16717 | { | ||
| 16718 | ✗ | return qe_invalid; | |
| 16719 | } | ||
| 16720 | |||
| 16721 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 272788 times.
|
272788 | if(!p_igetzf(&(tempffc.ay),f)) |
| 16722 | { | ||
| 16723 | ✗ | return qe_invalid; | |
| 16724 | } | ||
| 16725 | } | ||
| 16726 | |||
| 16727 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 272788 times.
|
272788 | if(!p_getc(&(tempffc.link),f)) |
| 16728 | { | ||
| 16729 | ✗ | return qe_invalid; | |
| 16730 | } | ||
| 16731 | |||
| 16732 |
1/2✓ Branch 0 taken 272788 times.
✗ Branch 1 not taken.
|
272788 | if(version>7) |
| 16733 | { | ||
| 16734 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 272788 times.
|
272788 | if(!p_getc(&tempbyte,f)) |
| 16735 | { | ||
| 16736 | ✗ | return qe_invalid; | |
| 16737 | } | ||
| 16738 | |||
| 16739 | 272788 | tempffc.hit_width = (tempbyte&0x3F)+1; | |
| 16740 | 272788 | tempffc.txsz = (tempbyte>>6)+1; | |
| 16741 | |||
| 16742 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 272788 times.
|
272788 | if(!p_getc(&tempbyte,f)) |
| 16743 | { | ||
| 16744 | ✗ | return qe_invalid; | |
| 16745 | } | ||
| 16746 | |||
| 16747 | 272788 | tempffc.hit_height = (tempbyte&0x3F)+1; | |
| 16748 | 272788 | tempffc.tysz = (tempbyte>>6)+1; | |
| 16749 | |||
| 16750 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 272788 times.
|
272788 | if(!p_igetl(&(tempffc.flags),f)) |
| 16751 | { | ||
| 16752 | ✗ | return qe_invalid; | |
| 16753 | } | ||
| 16754 | 272788 | } | |
| 16755 | else | ||
| 16756 | { | ||
| 16757 | ✗ | tempffc.hit_width=16; | |
| 16758 | ✗ | tempffc.hit_height=16; | |
| 16759 | ✗ | tempffc.txsz=1; | |
| 16760 | ✗ | tempffc.tysz=1; | |
| 16761 | ✗ | tempffc.flags=ffc_none; | |
| 16762 | } | ||
| 16763 | |||
| 16764 | 272788 | tempffc.updateSolid(); | |
| 16765 | |||
| 16766 | |||
| 16767 |
4/6✓ Branch 0 taken 272788 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 268748 times.
✓ Branch 3 taken 4040 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 268748 times.
|
272788 | if(Header->zelda_version == 0x211 || (Header->zelda_version == 0x250 && Header->build<20)) |
| 16768 | { | ||
| 16769 | ✗ | tempffc.flags|=ffc_ignoreholdup; | |
| 16770 | ✗ | } | |
| 16771 | |||
| 16772 |
1/2✓ Branch 0 taken 272788 times.
✗ Branch 1 not taken.
|
272788 | if(version>9) |
| 16773 | { | ||
| 16774 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 272788 times.
|
272788 | if(!p_igetw(&(tempffc.script),f)) |
| 16775 | { | ||
| 16776 | ✗ | return qe_invalid; | |
| 16777 | } | ||
| 16778 | 272788 | } | |
| 16779 | else | ||
| 16780 | { | ||
| 16781 | ✗ | tempffc.script=0; | |
| 16782 | } | ||
| 16783 | |||
| 16784 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 272788 times.
|
272788 | if(version>10) |
| 16785 | { | ||
| 16786 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 272788 times.
|
272788 | if(!p_igetl(&(tempffc.initd[0]),f)) |
| 16787 | { | ||
| 16788 | ✗ | return qe_invalid; | |
| 16789 | } | ||
| 16790 | |||
| 16791 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 272788 times.
|
272788 | if(!p_igetl(&(tempffc.initd[1]),f)) |
| 16792 | { | ||
| 16793 | ✗ | return qe_invalid; | |
| 16794 | } | ||
| 16795 | |||
| 16796 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 272788 times.
|
272788 | if(!p_igetl(&(tempffc.initd[2]),f)) |
| 16797 | { | ||
| 16798 | ✗ | return qe_invalid; | |
| 16799 | } | ||
| 16800 | |||
| 16801 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 272788 times.
|
272788 | if(!p_igetl(&(tempffc.initd[3]),f)) |
| 16802 | { | ||
| 16803 | ✗ | return qe_invalid; | |
| 16804 | } | ||
| 16805 | |||
| 16806 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 272788 times.
|
272788 | if(!p_igetl(&(tempffc.initd[4]),f)) |
| 16807 | { | ||
| 16808 | ✗ | return qe_invalid; | |
| 16809 | } | ||
| 16810 | |||
| 16811 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 272788 times.
|
272788 | if(!p_igetl(&(tempffc.initd[5]),f)) |
| 16812 | { | ||
| 16813 | ✗ | return qe_invalid; | |
| 16814 | } | ||
| 16815 | |||
| 16816 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 272788 times.
|
272788 | if(!p_igetl(&(tempffc.initd[6]),f)) |
| 16817 | { | ||
| 16818 | ✗ | return qe_invalid; | |
| 16819 | } | ||
| 16820 | |||
| 16821 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 272788 times.
|
272788 | if(!p_igetl(&(tempffc.initd[7]),f)) |
| 16822 | { | ||
| 16823 | ✗ | return qe_invalid; | |
| 16824 | } | ||
| 16825 | |||
| 16826 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 272788 times.
|
272788 | if(!p_getc(&(tempbyte),f)) |
| 16827 | { | ||
| 16828 | ✗ | return qe_invalid; | |
| 16829 | } | ||
| 16830 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 272788 times.
|
272788 | if(!p_getc(&(tempbyte),f)) |
| 16831 | { | ||
| 16832 | ✗ | return qe_invalid; | |
| 16833 | } | ||
| 16834 | 272788 | } | |
| 16835 | |||
| 16836 |
1/2✓ Branch 0 taken 272788 times.
✗ Branch 1 not taken.
|
272788 | if(loading_tileset_flags & TILESET_CLEARSCRIPTS) |
| 16837 | { | ||
| 16838 | ✗ | tempffc.script = 0; | |
| 16839 | ✗ | for(int q = 0; q < 8; ++q) | |
| 16840 | ✗ | tempffc.initd[q] = 0; | |
| 16841 | ✗ | } | |
| 16842 |
1/2✓ Branch 0 taken 272788 times.
✗ Branch 1 not taken.
|
272788 | if(version <= 11) |
| 16843 | { | ||
| 16844 | ✗ | fixffcs=true; | |
| 16845 | ✗ | } | |
| 16846 | 272788 | } | |
| 16847 | 20589312 | } | |
| 16848 | |||
| 16849 | 643416 | temp_mapscr->shinkToFitFFCs(); | |
| 16850 | 643416 | } | |
| 16851 | |||
| 16852 | |||
| 16853 | //add in the new whistle flags | ||
| 16854 |
2/2✓ Branch 0 taken 643416 times.
✓ Branch 1 taken 528504 times.
|
1171920 | if(version<13) |
| 16855 | { | ||
| 16856 |
2/2✓ Branch 0 taken 124 times.
✓ Branch 1 taken 528380 times.
|
528504 | if(temp_mapscr->flags & fWHISTLE) |
| 16857 | { | ||
| 16858 | 124 | temp_mapscr->flags7 |= (fWHISTLEPAL | fWHISTLEWATER); | |
| 16859 | 124 | } | |
| 16860 | 528504 | } | |
| 16861 | |||
| 16862 | //2.55 starts here | ||
| 16863 |
3/4✓ Branch 0 taken 27472 times.
✓ Branch 1 taken 1144448 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 27472 times.
|
1171920 | if ( version >= 19 && Header->zelda_version > 0x253 ) |
| 16864 | { | ||
| 16865 | // mapscr fields that were never used, so are now removed: | ||
| 16866 | // int32_t npcstrings[10]; | ||
| 16867 | // int16_t new_items[10]; | ||
| 16868 | // int16_t new_item_x[10]; | ||
| 16869 | // int16_t new_item_y[10]; | ||
| 16870 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 27472 times.
|
27472 | if (pack_fseek(f, 100)) |
| 16871 | { | ||
| 16872 | ✗ | return qe_invalid; | |
| 16873 | } | ||
| 16874 | 27472 | } | |
| 16875 | |||
| 16876 |
3/4✓ Branch 0 taken 27472 times.
✓ Branch 1 taken 1144448 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 27472 times.
|
1171920 | if ( version >= 20 && Header->zelda_version > 0x253 ) |
| 16877 | { | ||
| 16878 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 27472 times.
|
27472 | if(!p_igetw(&(temp_mapscr->script),f)) |
| 16879 | { | ||
| 16880 | ✗ | return qe_invalid; | |
| 16881 | } | ||
| 16882 |
2/2✓ Branch 0 taken 219776 times.
✓ Branch 1 taken 27472 times.
|
247248 | for ( int32_t q = 0; q < 8; q++) |
| 16883 | { | ||
| 16884 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 219776 times.
|
219776 | if(!p_igetl(&(temp_mapscr->screeninitd[q]),f)) |
| 16885 | { | ||
| 16886 | ✗ | return qe_invalid; | |
| 16887 | } | ||
| 16888 | 219776 | } | |
| 16889 | 27472 | } | |
| 16890 |
2/2✓ Branch 0 taken 1144448 times.
✓ Branch 1 taken 27472 times.
|
1171920 | if ( version < 20 ) |
| 16891 | { | ||
| 16892 | 1144448 | temp_mapscr->script = 0; | |
| 16893 |
2/2✓ Branch 0 taken 9155584 times.
✓ Branch 1 taken 1144448 times.
|
10300032 | for ( int32_t q = 0; q < 8; q++) temp_mapscr->screeninitd[q] = 0; |
| 16894 | 1144448 | } | |
| 16895 |
3/4✓ Branch 0 taken 27472 times.
✓ Branch 1 taken 1144448 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 27472 times.
|
1171920 | if ( version >= 21 && Header->zelda_version > 0x253 ) |
| 16896 | { | ||
| 16897 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 27472 times.
|
27472 | if(!p_getc(&(temp_mapscr->preloadscript),f)) |
| 16898 | { | ||
| 16899 | ✗ | return qe_invalid; | |
| 16900 | } | ||
| 16901 | 27472 | } | |
| 16902 |
2/2✓ Branch 0 taken 27472 times.
✓ Branch 1 taken 1144448 times.
|
1171920 | if ( version < 21 ) |
| 16903 | { | ||
| 16904 | 1144448 | temp_mapscr->preloadscript = 0; | |
| 16905 | 1144448 | } | |
| 16906 | |||
| 16907 |
3/4✓ Branch 0 taken 27472 times.
✓ Branch 1 taken 1144448 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 27472 times.
|
1171920 | if ( version >= 22 && Header->zelda_version > 0x253 ) //26th June, 2019; Layer Visibility |
| 16908 | { | ||
| 16909 |
1/2✓ Branch 0 taken 27472 times.
✗ Branch 1 not taken.
|
27472 | if(!p_getc(&(temp_mapscr->hidelayers ),f)) |
| 16910 | { | ||
| 16911 | ✗ | return qe_invalid; | |
| 16912 | } | ||
| 16913 |
1/2✓ Branch 0 taken 27472 times.
✗ Branch 1 not taken.
|
27472 | if(!p_getc(&(temp_mapscr->hidescriptlayers ),f)) |
| 16914 | { | ||
| 16915 | ✗ | return qe_invalid; | |
| 16916 | } | ||
| 16917 | 27472 | } | |
| 16918 |
2/2✓ Branch 0 taken 27472 times.
✓ Branch 1 taken 1144448 times.
|
1171920 | if ( version < 22 ) |
| 16919 | { | ||
| 16920 | 1144448 | temp_mapscr->hidelayers = 0; | |
| 16921 | 1144448 | temp_mapscr->hidescriptlayers = 0; | |
| 16922 | 1144448 | } | |
| 16923 | |||
| 16924 | //Dodongos in 2.10 used the boss roar, not the dodongo sound. -Z | ||
| 16925 | //May be any version before 2.11. -Z | ||
| 16926 | /* --not the roar, the HIT SFX | ||
| 16927 | if ( Header->zelda_version <= 0x210 ) | ||
| 16928 | { | ||
| 16929 | if ( temp_mapscr->bosssfx == WAV_DODONGO ) | ||
| 16930 | { | ||
| 16931 | temp_mapscr->bosssfx = WAV_ROAR; | ||
| 16932 | } | ||
| 16933 | } | ||
| 16934 | */ | ||
| 16935 |
2/2✓ Branch 0 taken 4687680 times.
✓ Branch 1 taken 1171920 times.
|
5859600 | for(int32_t k=0; k<4; k++) |
| 16936 | { | ||
| 16937 |
1/2✓ Branch 0 taken 4687680 times.
✗ Branch 1 not taken.
|
4687680 | if(temp_mapscr->door[k] == dNONE) |
| 16938 | ✗ | temp_mapscr->door[k] = dWALL; | |
| 16939 | 4687680 | } | |
| 16940 | |||
| 16941 | 1171920 | return 0; | |
| 16942 | 1171920 | } | |
| 16943 | 1377144 | int32_t readmapscreen(PACKFILE *f, zquestheader *Header, mapscr *temp_mapscr, word version, int scrind) | |
| 16944 | { | ||
| 16945 |
2/2✓ Branch 0 taken 1171920 times.
✓ Branch 1 taken 205224 times.
|
1377144 | if(version < 23) |
| 16946 | { | ||
| 16947 | 1171920 | auto ret = readmapscreen_old(f,Header,temp_mapscr,version,scrind); | |
| 16948 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1171920 times.
|
1171920 | if(ret) return ret; |
| 16949 | 1171920 | } | |
| 16950 | else | ||
| 16951 | { | ||
| 16952 |
1/2✓ Branch 0 taken 205224 times.
✗ Branch 1 not taken.
|
205224 | if(!p_getc(&(temp_mapscr->valid),f)) |
| 16953 | ✗ | return qe_invalid; | |
| 16954 |
2/2✓ Branch 0 taken 106457 times.
✓ Branch 1 taken 98767 times.
|
205224 | if(!(temp_mapscr->valid & mVALID)) |
| 16955 | { | ||
| 16956 | 98767 | int map = scrind/MAPSCRS; | |
| 16957 | 98767 | int screen = scrind%MAPSCRS; | |
| 16958 |
4/6✓ Branch 0 taken 91665 times.
✓ Branch 1 taken 7102 times.
✓ Branch 2 taken 91665 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 91665 times.
|
98767 | if(version > 25 && scrind > -1 && (map*6+5) < map_autolayers.size()) |
| 16959 | { | ||
| 16960 | //Empty screen, apply autolayers | ||
| 16961 |
2/2✓ Branch 0 taken 549990 times.
✓ Branch 1 taken 91665 times.
|
641655 | for(int q = 0; q < 6; ++q) |
| 16962 | { | ||
| 16963 | 549990 | auto layermap = map_autolayers[map*6+q]; | |
| 16964 | 549990 | temp_mapscr->layermap[q] = layermap; | |
| 16965 |
2/2✓ Branch 0 taken 534453 times.
✓ Branch 1 taken 15537 times.
|
549990 | if(layermap) |
| 16966 | 15537 | temp_mapscr->layerscreen[q] = screen; | |
| 16967 | 549990 | } | |
| 16968 | 91665 | } | |
| 16969 | 98767 | return 0; | |
| 16970 | } | ||
| 16971 | uint32_t scr_has_flags; | ||
| 16972 |
1/2✓ Branch 0 taken 106457 times.
✗ Branch 1 not taken.
|
106457 | if(!p_igetl(&scr_has_flags,f)) |
| 16973 | ✗ | return qe_invalid; | |
| 16974 | |||
| 16975 |
2/2✓ Branch 0 taken 10458 times.
✓ Branch 1 taken 95999 times.
|
106457 | if(scr_has_flags & SCRHAS_ROOMDATA) |
| 16976 | { | ||
| 16977 |
1/2✓ Branch 0 taken 95999 times.
✗ Branch 1 not taken.
|
95999 | if(!p_getc(&(temp_mapscr->guy),f)) |
| 16978 | ✗ | return qe_invalid; | |
| 16979 |
2/2✓ Branch 0 taken 95879 times.
✓ Branch 1 taken 120 times.
|
95999 | if(version > 26) |
| 16980 | { | ||
| 16981 |
1/2✓ Branch 0 taken 95879 times.
✗ Branch 1 not taken.
|
95879 | if(!p_igetl(&(temp_mapscr->guytile),f)) |
| 16982 | ✗ | return qe_invalid; | |
| 16983 |
1/2✓ Branch 0 taken 95879 times.
✗ Branch 1 not taken.
|
95879 | if(!p_getc(&(temp_mapscr->guycs),f)) |
| 16984 | ✗ | return qe_invalid; | |
| 16985 |
1/2✓ Branch 0 taken 95879 times.
✗ Branch 1 not taken.
|
95879 | if(!p_igetw(&(temp_mapscr->roomflags),f)) |
| 16986 | ✗ | return qe_invalid; | |
| 16987 | 95879 | } | |
| 16988 | else | ||
| 16989 | { | ||
| 16990 | 120 | temp_mapscr->guytile = -1; //signal to use default guy values | |
| 16991 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 120 times.
|
120 | SETFLAG(temp_mapscr->roomflags,RFL_ALWAYS_GUY,temp_mapscr->guy==gFAIRY); |
| 16992 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 120 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
120 | SETFLAG(temp_mapscr->roomflags,RFL_GUYFIRES,temp_mapscr->guy!=gFAIRY || !get_qr(qr_NOFAIRYGUYFIRES)); |
| 16993 | } | ||
| 16994 |
1/2✓ Branch 0 taken 95999 times.
✗ Branch 1 not taken.
|
95999 | if(!p_igetw(&(temp_mapscr->str),f)) |
| 16995 | ✗ | return qe_invalid; | |
| 16996 |
1/2✓ Branch 0 taken 95999 times.
✗ Branch 1 not taken.
|
95999 | if(!p_getc(&(temp_mapscr->room),f)) |
| 16997 | ✗ | return qe_invalid; | |
| 16998 |
1/2✓ Branch 0 taken 95999 times.
✗ Branch 1 not taken.
|
95999 | if(!p_igetw(&(temp_mapscr->catchall),f)) |
| 16999 | ✗ | return qe_invalid; | |
| 17000 | 95999 | } | |
| 17001 |
2/2✓ Branch 0 taken 104083 times.
✓ Branch 1 taken 2374 times.
|
106457 | if(scr_has_flags & SCRHAS_ITEM) |
| 17002 | { | ||
| 17003 |
1/2✓ Branch 0 taken 2374 times.
✗ Branch 1 not taken.
|
2374 | if(!p_getc(&(temp_mapscr->item),f)) |
| 17004 | ✗ | return qe_invalid; | |
| 17005 |
1/2✓ Branch 0 taken 2374 times.
✗ Branch 1 not taken.
|
2374 | if(!p_getc(&(temp_mapscr->hasitem),f)) |
| 17006 | ✗ | return qe_invalid; | |
| 17007 |
1/2✓ Branch 0 taken 2374 times.
✗ Branch 1 not taken.
|
2374 | if(!p_getc(&(temp_mapscr->itemx),f)) |
| 17008 | ✗ | return qe_invalid; | |
| 17009 |
1/2✓ Branch 0 taken 2374 times.
✗ Branch 1 not taken.
|
2374 | if(!p_getc(&(temp_mapscr->itemy),f)) |
| 17010 | ✗ | return qe_invalid; | |
| 17011 | 2374 | } | |
| 17012 |
2/2✓ Branch 0 taken 95777 times.
✓ Branch 1 taken 10680 times.
|
106457 | if(scr_has_flags & (SCRHAS_SWARP|SCRHAS_TWARP)) |
| 17013 | { | ||
| 17014 |
1/2✓ Branch 0 taken 10680 times.
✗ Branch 1 not taken.
|
10680 | if(!p_igetw(&temp_mapscr->warpreturnc,f)) |
| 17015 | ✗ | return qe_invalid; | |
| 17016 | 10680 | } | |
| 17017 |
2/2✓ Branch 0 taken 103970 times.
✓ Branch 1 taken 2487 times.
|
106457 | if(scr_has_flags & SCRHAS_TWARP) |
| 17018 | { | ||
| 17019 |
2/2✓ Branch 0 taken 9948 times.
✓ Branch 1 taken 2487 times.
|
12435 | for(int32_t i=0; i<4; i++) |
| 17020 | { | ||
| 17021 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 9948 times.
|
9948 | if(!p_getc(&(temp_mapscr->tilewarptype[i]),f)) |
| 17022 | ✗ | return qe_invalid; | |
| 17023 | 9948 | } | |
| 17024 |
2/2✓ Branch 0 taken 9948 times.
✓ Branch 1 taken 2487 times.
|
12435 | for(int32_t i=0; i<4; i++) |
| 17025 | { | ||
| 17026 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 9948 times.
|
9948 | if(!p_igetw(&(temp_mapscr->tilewarpdmap[i]),f)) |
| 17027 | ✗ | return qe_invalid; | |
| 17028 | 9948 | } | |
| 17029 |
2/2✓ Branch 0 taken 9948 times.
✓ Branch 1 taken 2487 times.
|
12435 | for(int32_t i=0; i<4; i++) |
| 17030 | { | ||
| 17031 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 9948 times.
|
9948 | if(!p_getc(&(temp_mapscr->tilewarpscr[i]),f)) |
| 17032 | ✗ | return qe_invalid; | |
| 17033 | 9948 | } | |
| 17034 |
1/2✓ Branch 0 taken 2487 times.
✗ Branch 1 not taken.
|
2487 | if(!p_getc(&(temp_mapscr->tilewarpoverlayflags),f)) |
| 17035 | ✗ | return qe_invalid; | |
| 17036 | 2487 | } | |
| 17037 |
2/2✓ Branch 0 taken 97789 times.
✓ Branch 1 taken 8668 times.
|
106457 | if(scr_has_flags & SCRHAS_SWARP) |
| 17038 | { | ||
| 17039 |
2/2✓ Branch 0 taken 34672 times.
✓ Branch 1 taken 8668 times.
|
43340 | for(int32_t i=0; i<4; i++) |
| 17040 | { | ||
| 17041 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 34672 times.
|
34672 | if(!p_getc(&(temp_mapscr->sidewarptype[i]),f)) |
| 17042 | ✗ | return qe_invalid; | |
| 17043 | 34672 | } | |
| 17044 |
2/2✓ Branch 0 taken 34672 times.
✓ Branch 1 taken 8668 times.
|
43340 | for(int32_t i=0; i<4; i++) |
| 17045 | { | ||
| 17046 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 34672 times.
|
34672 | if(!p_igetw(&(temp_mapscr->sidewarpdmap[i]),f)) |
| 17047 | ✗ | return qe_invalid; | |
| 17048 | 34672 | } | |
| 17049 |
2/2✓ Branch 0 taken 34672 times.
✓ Branch 1 taken 8668 times.
|
43340 | for(int32_t i=0; i<4; i++) |
| 17050 | { | ||
| 17051 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 34672 times.
|
34672 | if(!p_getc(&(temp_mapscr->sidewarpscr[i]),f)) |
| 17052 | ✗ | return qe_invalid; | |
| 17053 | 34672 | } | |
| 17054 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 8668 times.
|
8668 | if(!p_getc(&(temp_mapscr->sidewarpoverlayflags),f)) |
| 17055 | ✗ | return qe_invalid; | |
| 17056 |
1/2✓ Branch 0 taken 8668 times.
✗ Branch 1 not taken.
|
8668 | if(!p_getc(&(temp_mapscr->sidewarpindex),f)) |
| 17057 | ✗ | return qe_invalid; | |
| 17058 | 8668 | } | |
| 17059 |
2/2✓ Branch 0 taken 99754 times.
✓ Branch 1 taken 6703 times.
|
106457 | if(scr_has_flags & SCRHAS_WARPRET) |
| 17060 | { | ||
| 17061 |
2/2✓ Branch 0 taken 26812 times.
✓ Branch 1 taken 6703 times.
|
33515 | for(int32_t i=0; i<4; i++) |
| 17062 | { | ||
| 17063 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 26812 times.
|
26812 | if(!p_getc(&(temp_mapscr->warpreturnx[i]),f)) |
| 17064 | ✗ | return qe_invalid; | |
| 17065 | 26812 | } | |
| 17066 |
2/2✓ Branch 0 taken 26812 times.
✓ Branch 1 taken 6703 times.
|
33515 | for(int32_t i=0; i<4; i++) |
| 17067 | { | ||
| 17068 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 26812 times.
|
26812 | if(!p_getc(&(temp_mapscr->warpreturny[i]),f)) |
| 17069 | ✗ | return qe_invalid; | |
| 17070 | 26812 | } | |
| 17071 |
1/2✓ Branch 0 taken 6703 times.
✗ Branch 1 not taken.
|
6703 | if(!p_getc(&(temp_mapscr->warparrivalx),f)) |
| 17072 | ✗ | return qe_invalid; | |
| 17073 |
1/2✓ Branch 0 taken 6703 times.
✗ Branch 1 not taken.
|
6703 | if(!p_getc(&(temp_mapscr->warparrivaly),f)) |
| 17074 | ✗ | return qe_invalid; | |
| 17075 | 6703 | } | |
| 17076 |
2/2✓ Branch 0 taken 92933 times.
✓ Branch 1 taken 13524 times.
|
106457 | if(scr_has_flags & SCRHAS_LAYERS) |
| 17077 | { | ||
| 17078 |
2/2✓ Branch 0 taken 81144 times.
✓ Branch 1 taken 13524 times.
|
94668 | for(int32_t k=0; k<6; k++) |
| 17079 | { | ||
| 17080 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 81144 times.
|
81144 | if(!p_getc(&(temp_mapscr->layermap[k]),f)) |
| 17081 | ✗ | return qe_invalid; | |
| 17082 | 81144 | } | |
| 17083 |
2/2✓ Branch 0 taken 81144 times.
✓ Branch 1 taken 13524 times.
|
94668 | for(int32_t k=0; k<6; k++) |
| 17084 | { | ||
| 17085 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 81144 times.
|
81144 | if(!p_getc(&(temp_mapscr->layerscreen[k]),f)) |
| 17086 | ✗ | return qe_invalid; | |
| 17087 | 81144 | } | |
| 17088 |
2/2✓ Branch 0 taken 81144 times.
✓ Branch 1 taken 13524 times.
|
94668 | for(int32_t k=0; k<6; k++) |
| 17089 | { | ||
| 17090 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 81144 times.
|
81144 | if(!p_getc(&(temp_mapscr->layeropacity[k]),f)) |
| 17091 | ✗ | return qe_invalid; | |
| 17092 | 81144 | } | |
| 17093 |
1/2✓ Branch 0 taken 13524 times.
✗ Branch 1 not taken.
|
13524 | if(!p_getc(&(temp_mapscr->hidelayers),f)) |
| 17094 | ✗ | return qe_invalid; | |
| 17095 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 13524 times.
|
13524 | if(!p_getc(&(temp_mapscr->hidescriptlayers),f)) |
| 17096 | ✗ | return qe_invalid; | |
| 17097 | 13524 | } | |
| 17098 |
2/2✓ Branch 0 taken 106353 times.
✓ Branch 1 taken 104 times.
|
106457 | if(scr_has_flags & SCRHAS_MAZE) |
| 17099 | { | ||
| 17100 |
2/2✓ Branch 0 taken 416 times.
✓ Branch 1 taken 104 times.
|
520 | for(int32_t k=0; k<4; k++) |
| 17101 | { | ||
| 17102 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 416 times.
|
416 | if(!p_getc(&(temp_mapscr->path[k]),f)) |
| 17103 | ✗ | return qe_invalid; | |
| 17104 | 416 | } | |
| 17105 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 104 times.
|
104 | if(!p_getc(&(temp_mapscr->exitdir),f)) |
| 17106 | ✗ | return qe_invalid; | |
| 17107 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 104 times.
|
104 | if (version >= 32) |
| 17108 | { | ||
| 17109 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 104 times.
|
104 | if (!p_getc(&temp_mapscr->maze_transition_wipe, f)) |
| 17110 | ✗ | return qe_invalid; | |
| 17111 | 104 | } | |
| 17112 | 104 | } | |
| 17113 |
2/2✓ Branch 0 taken 77516 times.
✓ Branch 1 taken 28941 times.
|
106457 | if(scr_has_flags & SCRHAS_D_S_U) |
| 17114 | { | ||
| 17115 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 77516 times.
|
77516 | if(!p_igetw(&(temp_mapscr->door_combo_set),f)) |
| 17116 | ✗ | return qe_invalid; | |
| 17117 |
2/2✓ Branch 0 taken 310064 times.
✓ Branch 1 taken 77516 times.
|
387580 | for(int32_t k=0; k<4; k++) |
| 17118 | { | ||
| 17119 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 310064 times.
|
310064 | if(!p_getc(&(temp_mapscr->door[k]),f)) |
| 17120 | ✗ | return qe_invalid; | |
| 17121 |
3/4✓ Branch 0 taken 360 times.
✓ Branch 1 taken 309704 times.
✓ Branch 2 taken 360 times.
✗ Branch 3 not taken.
|
310064 | if(version < 29 && temp_mapscr->door[k] == dNONE) |
| 17122 | ✗ | temp_mapscr->door[k] = dWALL; | |
| 17123 | 310064 | } | |
| 17124 | |||
| 17125 |
1/2✓ Branch 0 taken 77516 times.
✗ Branch 1 not taken.
|
77516 | if(!p_getc(&(temp_mapscr->stairx),f)) |
| 17126 | ✗ | return qe_invalid; | |
| 17127 | |||
| 17128 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 77516 times.
|
77516 | if(!p_getc(&(temp_mapscr->stairy),f)) |
| 17129 | ✗ | return qe_invalid; | |
| 17130 |
1/2✓ Branch 0 taken 77516 times.
✗ Branch 1 not taken.
|
77516 | if(!p_igetw(&(temp_mapscr->undercombo),f)) |
| 17131 | ✗ | return qe_invalid; | |
| 17132 |
1/2✓ Branch 0 taken 77516 times.
✗ Branch 1 not taken.
|
77516 | if(!p_getc(&(temp_mapscr->undercset),f)) |
| 17133 | ✗ | return qe_invalid; | |
| 17134 | 77516 | } | |
| 17135 |
2/2✓ Branch 0 taken 10488 times.
✓ Branch 1 taken 18453 times.
|
28941 | else if(version < 29) |
| 17136 | { | ||
| 17137 |
2/2✓ Branch 0 taken 41952 times.
✓ Branch 1 taken 10488 times.
|
52440 | for(int k = 0; k < 4; ++k) |
| 17138 | 41952 | temp_mapscr->door[k] = dWALL; | |
| 17139 | 10488 | } | |
| 17140 |
2/2✓ Branch 0 taken 99955 times.
✓ Branch 1 taken 6502 times.
|
106457 | if(scr_has_flags & SCRHAS_FLAGS) |
| 17141 | { | ||
| 17142 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 6502 times.
|
6502 | if(!p_getc(&(temp_mapscr->flags),f)) |
| 17143 | ✗ | return qe_invalid; | |
| 17144 |
1/2✓ Branch 0 taken 6502 times.
✗ Branch 1 not taken.
|
6502 | if(!p_getc(&(temp_mapscr->flags2),f)) |
| 17145 | ✗ | return qe_invalid; | |
| 17146 |
1/2✓ Branch 0 taken 6502 times.
✗ Branch 1 not taken.
|
6502 | if(!p_getc(&(temp_mapscr->flags3),f)) |
| 17147 | ✗ | return qe_invalid; | |
| 17148 |
1/2✓ Branch 0 taken 6502 times.
✗ Branch 1 not taken.
|
6502 | if(!p_getc(&(temp_mapscr->flags4),f)) |
| 17149 | ✗ | return qe_invalid; | |
| 17150 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 6502 times.
|
6502 | if(!p_getc(&(temp_mapscr->flags5),f)) |
| 17151 | ✗ | return qe_invalid; | |
| 17152 |
1/2✓ Branch 0 taken 6502 times.
✗ Branch 1 not taken.
|
6502 | if(!p_getc(&(temp_mapscr->flags6),f)) |
| 17153 | ✗ | return qe_invalid; | |
| 17154 |
1/2✓ Branch 0 taken 6502 times.
✗ Branch 1 not taken.
|
6502 | if(!p_getc(&(temp_mapscr->flags7),f)) |
| 17155 | ✗ | return qe_invalid; | |
| 17156 |
1/2✓ Branch 0 taken 6502 times.
✗ Branch 1 not taken.
|
6502 | if(!p_getc(&(temp_mapscr->flags8),f)) |
| 17157 | ✗ | return qe_invalid; | |
| 17158 |
1/2✓ Branch 0 taken 6502 times.
✗ Branch 1 not taken.
|
6502 | if(!p_getc(&(temp_mapscr->flags9),f)) |
| 17159 | ✗ | return qe_invalid; | |
| 17160 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 6502 times.
|
6502 | if(!p_getc(&(temp_mapscr->flags10),f)) |
| 17161 | ✗ | return qe_invalid; | |
| 17162 |
1/2✓ Branch 0 taken 6502 times.
✗ Branch 1 not taken.
|
6502 | if(!p_getc(&(temp_mapscr->flags11),f)) |
| 17163 | ✗ | return qe_invalid; | |
| 17164 | 6502 | } | |
| 17165 |
2/2✓ Branch 0 taken 101164 times.
✓ Branch 1 taken 5293 times.
|
106457 | if(scr_has_flags & SCRHAS_ENEMY) |
| 17166 | { | ||
| 17167 |
2/2✓ Branch 0 taken 52930 times.
✓ Branch 1 taken 5293 times.
|
58223 | for(int32_t k=0; k<10; k++) |
| 17168 | { | ||
| 17169 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 52930 times.
|
52930 | if(!p_igetw(&(temp_mapscr->enemy[k]),f)) |
| 17170 | ✗ | return qe_invalid; | |
| 17171 |
1/2✓ Branch 0 taken 52930 times.
✗ Branch 1 not taken.
|
52930 | if (unsigned(temp_mapscr->enemy[k]) > MAXGUYS) |
| 17172 | ✗ | temp_mapscr->enemy[k] = 0; | |
| 17173 | 52930 | } | |
| 17174 |
1/2✓ Branch 0 taken 5293 times.
✗ Branch 1 not taken.
|
5293 | if(!p_getc(&(temp_mapscr->pattern),f)) |
| 17175 | ✗ | return qe_invalid; | |
| 17176 | 5293 | } | |
| 17177 |
2/2✓ Branch 0 taken 37004 times.
✓ Branch 1 taken 69453 times.
|
106457 | if(scr_has_flags & SCRHAS_CARRY) |
| 17178 | { | ||
| 17179 |
2/2✓ Branch 0 taken 358 times.
✓ Branch 1 taken 36646 times.
|
37004 | if(version < 34) |
| 17180 | { | ||
| 17181 | word tmpw; | ||
| 17182 |
1/2✓ Branch 0 taken 358 times.
✗ Branch 1 not taken.
|
358 | if(!p_igetw(&tmpw,f)) |
| 17183 | ✗ | return qe_invalid; | |
| 17184 | 358 | temp_mapscr->noreset = tmpw | mLIGHTBEAM | mTMPNORET | mVISITED; | |
| 17185 |
1/2✓ Branch 0 taken 358 times.
✗ Branch 1 not taken.
|
358 | if(!p_igetw(&tmpw,f)) |
| 17186 | ✗ | return qe_invalid; | |
| 17187 | 716 | temp_mapscr->nocarry = tmpw | mLIGHTBEAM | mTMPNORET | mVISITED | | |
| 17188 | 358 | mDOOR_UP | mDOOR_DOWN | mDOOR_LEFT | mDOOR_RIGHT | mNEVERRET | mNO_ENEMIES_RETURN; | |
| 17189 | 358 | } | |
| 17190 | else | ||
| 17191 | { | ||
| 17192 |
1/2✓ Branch 0 taken 36646 times.
✗ Branch 1 not taken.
|
36646 | if(!p_igetl(&(temp_mapscr->noreset),f)) |
| 17193 | ✗ | return qe_invalid; | |
| 17194 |
1/2✓ Branch 0 taken 36646 times.
✗ Branch 1 not taken.
|
36646 | if(!p_igetl(&(temp_mapscr->nocarry),f)) |
| 17195 | ✗ | return qe_invalid; | |
| 17196 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 36646 times.
|
36646 | if(!p_igetl(&(temp_mapscr->exstate_reset),f)) |
| 17197 | ✗ | return qe_invalid; | |
| 17198 |
1/2✓ Branch 0 taken 36646 times.
✗ Branch 1 not taken.
|
36646 | if(!p_igetl(&(temp_mapscr->exstate_carry),f)) |
| 17199 | ✗ | return qe_invalid; | |
| 17200 | } | ||
| 17201 |
1/2✓ Branch 0 taken 37004 times.
✗ Branch 1 not taken.
|
37004 | if(!p_getc(&(temp_mapscr->nextmap),f)) |
| 17202 | ✗ | return qe_invalid; | |
| 17203 |
1/2✓ Branch 0 taken 37004 times.
✗ Branch 1 not taken.
|
37004 | if(!p_getc(&(temp_mapscr->nextscr),f)) |
| 17204 | ✗ | return qe_invalid; | |
| 17205 | 37004 | } | |
| 17206 | else | ||
| 17207 | { | ||
| 17208 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 69453 times.
|
69453 | if(version < 34) |
| 17209 | { | ||
| 17210 | 69453 | temp_mapscr->noreset = mLIGHTBEAM | mTMPNORET | mVISITED; | |
| 17211 | 69453 | temp_mapscr->nocarry = mLIGHTBEAM | mTMPNORET | mVISITED | | |
| 17212 | mDOOR_UP | mDOOR_DOWN | mDOOR_LEFT | mDOOR_RIGHT | mNEVERRET | mNO_ENEMIES_RETURN; | ||
| 17213 | 69453 | } | |
| 17214 | } | ||
| 17215 |
2/2✓ Branch 0 taken 105858 times.
✓ Branch 1 taken 599 times.
|
106457 | if(scr_has_flags & SCRHAS_SCRIPT) |
| 17216 | { | ||
| 17217 |
1/2✓ Branch 0 taken 599 times.
✗ Branch 1 not taken.
|
599 | if(!p_igetw(&(temp_mapscr->script),f)) |
| 17218 | ✗ | return qe_invalid; | |
| 17219 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 599 times.
|
599 | if(!p_getc(&(temp_mapscr->preloadscript),f)) |
| 17220 | ✗ | return qe_invalid; | |
| 17221 |
2/2✓ Branch 0 taken 4792 times.
✓ Branch 1 taken 599 times.
|
5391 | for ( int32_t q = 0; q < 8; q++ ) |
| 17222 | { | ||
| 17223 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4792 times.
|
4792 | if(!p_igetl(&(temp_mapscr->screeninitd[q]),f)) |
| 17224 | ✗ | return qe_invalid; | |
| 17225 | 4792 | } | |
| 17226 | 599 | } | |
| 17227 |
2/2✓ Branch 0 taken 74969 times.
✓ Branch 1 taken 31488 times.
|
106457 | if(scr_has_flags & SCRHAS_SECRETS) |
| 17228 | { | ||
| 17229 |
2/2✓ Branch 0 taken 4030464 times.
✓ Branch 1 taken 31488 times.
|
4061952 | for(int32_t k=0; k<128; k++) |
| 17230 | { | ||
| 17231 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4030464 times.
|
4030464 | if(!p_igetw(&(temp_mapscr->secretcombo[k]),f)) |
| 17232 | ✗ | return qe_invalid; | |
| 17233 | 4030464 | } | |
| 17234 |
2/2✓ Branch 0 taken 4030464 times.
✓ Branch 1 taken 31488 times.
|
4061952 | for(int32_t k=0; k<128; k++) |
| 17235 | { | ||
| 17236 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4030464 times.
|
4030464 | if(!p_getc(&(temp_mapscr->secretcset[k]),f)) |
| 17237 | ✗ | return qe_invalid; | |
| 17238 | 4030464 | } | |
| 17239 |
2/2✓ Branch 0 taken 4030464 times.
✓ Branch 1 taken 31488 times.
|
4061952 | for(int32_t k=0; k<128; k++) |
| 17240 | { | ||
| 17241 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4030464 times.
|
4030464 | if(!p_getc(&(temp_mapscr->secretflag[k]),f)) |
| 17242 | ✗ | return qe_invalid; | |
| 17243 | 4030464 | } | |
| 17244 | 31488 | } | |
| 17245 |
2/2✓ Branch 0 taken 40661 times.
✓ Branch 1 taken 65796 times.
|
106457 | if(scr_has_flags & SCRHAS_COMBOFLAG) |
| 17246 | { | ||
| 17247 |
2/2✓ Branch 0 taken 11580096 times.
✓ Branch 1 taken 65796 times.
|
11645892 | for(int32_t k=0; k<176; ++k) |
| 17248 | { | ||
| 17249 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 11580096 times.
|
11580096 | if(!p_igetw(&(temp_mapscr->data[k]),f)) |
| 17250 | ✗ | return qe_invalid; | |
| 17251 | 11580096 | } | |
| 17252 |
2/2✓ Branch 0 taken 11580096 times.
✓ Branch 1 taken 65796 times.
|
11645892 | for(int32_t k=0; k<176; ++k) |
| 17253 | { | ||
| 17254 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 11580096 times.
|
11580096 | if(!p_getc(&(temp_mapscr->sflag[k]),f)) |
| 17255 | ✗ | return qe_invalid; | |
| 17256 | 11580096 | } | |
| 17257 |
2/2✓ Branch 0 taken 11580096 times.
✓ Branch 1 taken 65796 times.
|
11645892 | for(int32_t k=0; k<176; ++k) |
| 17258 | { | ||
| 17259 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 11580096 times.
|
11580096 | if(!p_getc(&(temp_mapscr->cset[k]),f)) |
| 17260 | ✗ | return qe_invalid; | |
| 17261 | 11580096 | } | |
| 17262 | 65796 | } | |
| 17263 |
1/2✓ Branch 0 taken 106457 times.
✗ Branch 1 not taken.
|
106457 | if(scr_has_flags & SCRHAS_MISC) |
| 17264 | { | ||
| 17265 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 106457 times.
|
106457 | if(!p_igetw(&(temp_mapscr->color),f)) |
| 17266 | ✗ | return qe_invalid; | |
| 17267 |
1/2✓ Branch 0 taken 106457 times.
✗ Branch 1 not taken.
|
106457 | if(!p_getc(&(temp_mapscr->csensitive),f)) |
| 17268 | ✗ | return qe_invalid; | |
| 17269 |
1/2✓ Branch 0 taken 106457 times.
✗ Branch 1 not taken.
|
106457 | if(!p_getc(&(temp_mapscr->oceansfx),f)) |
| 17270 | ✗ | return qe_invalid; | |
| 17271 |
1/2✓ Branch 0 taken 106457 times.
✗ Branch 1 not taken.
|
106457 | if(!p_getc(&(temp_mapscr->bosssfx),f)) |
| 17272 | ✗ | return qe_invalid; | |
| 17273 |
1/2✓ Branch 0 taken 106457 times.
✗ Branch 1 not taken.
|
106457 | if(!p_getc(&(temp_mapscr->secretsfx),f)) |
| 17274 | ✗ | return qe_invalid; | |
| 17275 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 106457 times.
|
106457 | if(!p_getc(&(temp_mapscr->holdupsfx),f)) |
| 17276 | ✗ | return qe_invalid; | |
| 17277 |
1/2✓ Branch 0 taken 106457 times.
✗ Branch 1 not taken.
|
106457 | if(!p_igetw(&(temp_mapscr->timedwarptics),f)) |
| 17278 | ✗ | return qe_invalid; | |
| 17279 |
1/2✓ Branch 0 taken 106457 times.
✗ Branch 1 not taken.
|
106457 | if(!p_igetw(&(temp_mapscr->screen_midi),f)) |
| 17280 | ✗ | return qe_invalid; | |
| 17281 |
1/2✓ Branch 0 taken 106457 times.
✗ Branch 1 not taken.
|
106457 | if(!p_getc(&(temp_mapscr->lens_layer),f)) |
| 17282 | ✗ | return qe_invalid; | |
| 17283 |
2/2✓ Branch 0 taken 10578 times.
✓ Branch 1 taken 95879 times.
|
106457 | if(version > 27) |
| 17284 | { | ||
| 17285 |
1/2✓ Branch 0 taken 95879 times.
✗ Branch 1 not taken.
|
95879 | if(!p_getc(&(temp_mapscr->lens_show),f)) |
| 17286 | ✗ | return qe_invalid; | |
| 17287 |
1/2✓ Branch 0 taken 95879 times.
✗ Branch 1 not taken.
|
95879 | if(!p_getc(&(temp_mapscr->lens_hide),f)) |
| 17288 | ✗ | return qe_invalid; | |
| 17289 | 95879 | } | |
| 17290 | 106457 | } | |
| 17291 | else | ||
| 17292 | { | ||
| 17293 | ✗ | temp_mapscr->screen_midi = -1; | |
| 17294 | ✗ | temp_mapscr->csensitive = 1; | |
| 17295 | } | ||
| 17296 | //FFC | ||
| 17297 | 106457 | bool old_ff = version < 25; | |
| 17298 | 106457 | dword bits = 0; | |
| 17299 | 106457 | word numffc = 32; | |
| 17300 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 106457 times.
|
106457 | if(old_ff) |
| 17301 | { | ||
| 17302 | ✗ | if(!p_igetl(&bits,f)) | |
| 17303 | ✗ | return qe_invalid; | |
| 17304 | ✗ | } | |
| 17305 | else | ||
| 17306 | { | ||
| 17307 |
2/4✓ Branch 0 taken 106457 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 106457 times.
|
106457 | if(!p_igetw(&numffc,f) || numffc > MAXFFCS) |
| 17308 | ✗ | return qe_invalid; | |
| 17309 | } | ||
| 17310 | |||
| 17311 | 106457 | temp_mapscr->ffcCountMarkDirty(); | |
| 17312 | 106457 | temp_mapscr->ffcs.clear(); | |
| 17313 | 106457 | temp_mapscr->resizeFFC(numffc); | |
| 17314 | |||
| 17315 | byte tempbyte; | ||
| 17316 | word tempw; | ||
| 17317 |
4/6✓ Branch 0 taken 163 times.
✓ Branch 1 taken 106294 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 163 times.
✓ Branch 4 taken 163 times.
✗ Branch 5 not taken.
|
106457 | static ffcdata nil_ffc; |
| 17318 |
2/2✓ Branch 0 taken 1982105 times.
✓ Branch 1 taken 106457 times.
|
2088562 | for(word m = 0; m < numffc; ++m) |
| 17319 | { | ||
| 17320 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 1982105 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
1982105 | if(old_ff && !(bits & (1<<m))) continue; |
| 17321 | |||
| 17322 |
1/2✓ Branch 0 taken 1982105 times.
✗ Branch 1 not taken.
|
1982105 | ffcdata& tempffc = (m < MAXFFCS) |
| 17323 | 1982105 | ? temp_mapscr->ffcs[m] | |
| 17324 | : nil_ffc; //sanity | ||
| 17325 | |||
| 17326 |
1/2✓ Branch 0 taken 1982105 times.
✗ Branch 1 not taken.
|
1982105 | if(!p_igetw(&tempw,f)) |
| 17327 | ✗ | return qe_invalid; | |
| 17328 |
3/4✓ Branch 0 taken 1982105 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 14681 times.
✓ Branch 3 taken 1967424 times.
|
1982105 | if(!old_ff && !tempw) //empty ffc, nothing more to load |
| 17329 | 1967424 | continue; | |
| 17330 | 14681 | tempffc.data = tempw; | |
| 17331 | |||
| 17332 |
1/2✓ Branch 0 taken 14681 times.
✗ Branch 1 not taken.
|
14681 | if(!p_getc(&(tempffc.cset),f)) |
| 17333 | ✗ | return qe_invalid; | |
| 17334 |
1/2✓ Branch 0 taken 14681 times.
✗ Branch 1 not taken.
|
14681 | if(!p_igetw(&(tempffc.delay),f)) |
| 17335 | ✗ | return qe_invalid; | |
| 17336 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 14681 times.
|
14681 | if(!p_igetzf(&(tempffc.x),f)) |
| 17337 | ✗ | return qe_invalid; | |
| 17338 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 14681 times.
|
14681 | if(!p_igetzf(&(tempffc.y),f)) |
| 17339 | ✗ | return qe_invalid; | |
| 17340 |
1/2✓ Branch 0 taken 14681 times.
✗ Branch 1 not taken.
|
14681 | if(!p_igetzf(&(tempffc.vx),f)) |
| 17341 | ✗ | return qe_invalid; | |
| 17342 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 14681 times.
|
14681 | if(!p_igetzf(&(tempffc.vy),f)) |
| 17343 | ✗ | return qe_invalid; | |
| 17344 |
1/2✓ Branch 0 taken 14681 times.
✗ Branch 1 not taken.
|
14681 | if(!p_igetzf(&(tempffc.ax),f)) |
| 17345 | ✗ | return qe_invalid; | |
| 17346 |
1/2✓ Branch 0 taken 14681 times.
✗ Branch 1 not taken.
|
14681 | if(!p_igetzf(&(tempffc.ay),f)) |
| 17347 | ✗ | return qe_invalid; | |
| 17348 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 14681 times.
|
14681 | if(!p_getc(&(tempffc.link),f)) |
| 17349 | ✗ | return qe_invalid; | |
| 17350 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 14681 times.
|
14681 | if(version < 24) |
| 17351 | { | ||
| 17352 | ✗ | if(!p_getc(&tempbyte,f)) | |
| 17353 | ✗ | return qe_invalid; | |
| 17354 | ✗ | tempffc.hit_width = (tempbyte&0x3F)+1; | |
| 17355 | ✗ | tempffc.txsz = (tempbyte>>6)+1; | |
| 17356 | ✗ | if(!p_getc(&tempbyte,f)) | |
| 17357 | ✗ | return qe_invalid; | |
| 17358 | ✗ | tempffc.hit_height = (tempbyte&0x3F)+1; | |
| 17359 | ✗ | tempffc.tysz = (tempbyte>>6)+1; | |
| 17360 | ✗ | } | |
| 17361 | else | ||
| 17362 | { | ||
| 17363 |
1/2✓ Branch 0 taken 14681 times.
✗ Branch 1 not taken.
|
14681 | if(!p_igetl(&(tempffc.hit_width),f)) |
| 17364 | ✗ | return qe_invalid; | |
| 17365 |
1/2✓ Branch 0 taken 14681 times.
✗ Branch 1 not taken.
|
14681 | if(!p_igetl(&(tempffc.hit_height),f)) |
| 17366 | ✗ | return qe_invalid; | |
| 17367 |
1/2✓ Branch 0 taken 14681 times.
✗ Branch 1 not taken.
|
14681 | if(!p_getc(&(tempffc.txsz),f)) |
| 17368 | ✗ | return qe_invalid; | |
| 17369 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 14681 times.
|
14681 | if(!p_getc(&(tempffc.tysz),f)) |
| 17370 | ✗ | return qe_invalid; | |
| 17371 | } | ||
| 17372 |
1/2✓ Branch 0 taken 14681 times.
✗ Branch 1 not taken.
|
14681 | if(!p_igetl(&(tempffc.flags),f)) |
| 17373 | ✗ | return qe_invalid; | |
| 17374 | 14681 | tempffc.updateSolid(); | |
| 17375 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 14681 times.
|
14681 | if(!p_igetw(&(tempffc.script),f)) |
| 17376 | ✗ | return qe_invalid; | |
| 17377 |
2/2✓ Branch 0 taken 117448 times.
✓ Branch 1 taken 14681 times.
|
132129 | for(auto q = 0; q < 8; ++q) |
| 17378 | { | ||
| 17379 |
1/2✓ Branch 0 taken 117448 times.
✗ Branch 1 not taken.
|
117448 | if(!p_igetl(&(tempffc.initd[q]),f)) |
| 17380 | ✗ | return qe_invalid; | |
| 17381 | 117448 | } | |
| 17382 |
2/2✓ Branch 0 taken 8011 times.
✓ Branch 1 taken 6670 times.
|
14681 | if(version < 33) |
| 17383 | { | ||
| 17384 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 8011 times.
|
8011 | if(!p_getc(&(tempbyte),f)) |
| 17385 | ✗ | return qe_invalid; | |
| 17386 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 8011 times.
|
8011 | if(!p_getc(&(tempbyte),f)) |
| 17387 | ✗ | return qe_invalid; | |
| 17388 | 8011 | } | |
| 17389 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 6670 times.
|
6670 | else if(!p_getc(&(tempffc.layer),f)) |
| 17390 | ✗ | return qe_invalid; | |
| 17391 | |||
| 17392 |
1/2✓ Branch 0 taken 14681 times.
✗ Branch 1 not taken.
|
14681 | if(loading_tileset_flags & TILESET_CLEARSCRIPTS) |
| 17393 | { | ||
| 17394 | ✗ | tempffc.script = 0; | |
| 17395 | ✗ | for(int q = 0; q < 8; ++q) | |
| 17396 | ✗ | tempffc.initd[q] = 0; | |
| 17397 | ✗ | } | |
| 17398 | 14681 | } | |
| 17399 | //END FFC | ||
| 17400 |
2/2✓ Branch 0 taken 38497 times.
✓ Branch 1 taken 67960 times.
|
106457 | if(version > 29) |
| 17401 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 67960 times.
|
67960 | if(!p_getlstr(&temp_mapscr->usr_notes, f)) |
| 17402 | ✗ | return qe_invalid; | |
| 17403 | } | ||
| 17404 | |||
| 17405 | 1278377 | temp_mapscr->shinkToFitFFCs(); | |
| 17406 | |||
| 17407 | 1278377 | return 0; | |
| 17408 | 1377144 | } | |
| 17409 | |||
| 17410 | 479 | int32_t readmaps(PACKFILE *f, zquestheader *Header) | |
| 17411 | { | ||
| 17412 |
2/2✓ Branch 0 taken 455 times.
✓ Branch 1 taken 24 times.
|
479 | bool should_skip = legacy_skip_flags && get_bit(legacy_skip_flags, skip_maps); |
| 17413 | 479 | int32_t screen=0; | |
| 17414 | |||
| 17415 | 479 | word version=0; | |
| 17416 | dword dummy; | ||
| 17417 | int32_t screens_to_read; | ||
| 17418 | |||
| 17419 | 479 | mapscr temp_mapscr{}; | |
| 17420 | word temp_map_count; | ||
| 17421 | dword section_size; | ||
| 17422 | |||
| 17423 |
5/6✓ Branch 0 taken 461 times.
✓ Branch 1 taken 18 times.
✓ Branch 2 taken 6 times.
✓ Branch 3 taken 455 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 6 times.
|
479 | if((Header->zelda_version < 0x192)||((Header->zelda_version == 0x192)&&(Header->build<137))) |
| 17424 | { | ||
| 17425 | 18 | screens_to_read=MAPSCRS192b136; | |
| 17426 | 18 | } | |
| 17427 | else | ||
| 17428 | { | ||
| 17429 | 461 | screens_to_read=MAPSCRS; | |
| 17430 | } | ||
| 17431 | |||
| 17432 |
2/2✓ Branch 0 taken 455 times.
✓ Branch 1 taken 24 times.
|
479 | if(Header->zelda_version > 0x192) |
| 17433 | { | ||
| 17434 | //section version info | ||
| 17435 |
2/4✓ Branch 0 taken 455 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 455 times.
✗ Branch 3 not taken.
|
455 | if(!p_igetw(&version,f)) |
| 17436 | { | ||
| 17437 | ✗ | return qe_invalid; | |
| 17438 | } | ||
| 17439 | |||
| 17440 | 455 | FFCore.quest_format[vMaps] = version; | |
| 17441 | |||
| 17442 |
2/4✓ Branch 0 taken 455 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 455 times.
✗ Branch 3 not taken.
|
455 | if(!p_igetw(&dummy,f)) |
| 17443 | { | ||
| 17444 | ✗ | return qe_invalid; | |
| 17445 | } | ||
| 17446 | |||
| 17447 | //section size | ||
| 17448 |
2/4✓ Branch 0 taken 455 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 455 times.
✗ Branch 3 not taken.
|
455 | if(!p_igetl(§ion_size,f)) |
| 17449 | { | ||
| 17450 | ✗ | return qe_invalid; | |
| 17451 | } | ||
| 17452 | |||
| 17453 | //finally... section data | ||
| 17454 |
2/4✓ Branch 0 taken 455 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 455 times.
✗ Branch 3 not taken.
|
455 | if(!p_igetw(&temp_map_count,f)) |
| 17455 | { | ||
| 17456 | ✗ | return 5; | |
| 17457 | } | ||
| 17458 | 455 | } | |
| 17459 | else | ||
| 17460 | { | ||
| 17461 | 24 | temp_map_count=map_count; | |
| 17462 | } | ||
| 17463 | |||
| 17464 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 479 times.
|
479 | if (temp_map_count > MAXMAPS) |
| 17465 | { | ||
| 17466 | ✗ | return qe_invalid; | |
| 17467 | } | ||
| 17468 | |||
| 17469 |
2/2✓ Branch 0 taken 478 times.
✓ Branch 1 taken 1 times.
|
479 | if (!should_skip) |
| 17470 | { | ||
| 17471 | 478 | const int32_t _mapsSize = MAPSCRS*temp_map_count; | |
| 17472 | 478 | TheMaps.clear(); | |
| 17473 |
1/2✓ Branch 0 taken 478 times.
✗ Branch 1 not taken.
|
478 | TheMaps.resize(_mapsSize); |
| 17474 | 478 | old_combo_pages.clear(); | |
| 17475 |
1/2✓ Branch 0 taken 478 times.
✗ Branch 1 not taken.
|
478 | old_combo_pages.resize(_mapsSize); |
| 17476 | 478 | map_autolayers.clear(); | |
| 17477 |
1/2✓ Branch 0 taken 478 times.
✗ Branch 1 not taken.
|
478 | map_autolayers.resize(temp_map_count*6); |
| 17478 |
2/2✓ Branch 0 taken 326 times.
✓ Branch 1 taken 152 times.
|
478 | if(version >= 31) |
| 17479 | 152 | Regions = {}; | |
| 17480 | 478 | } | |
| 17481 | |||
| 17482 |
4/4✓ Branch 0 taken 479 times.
✓ Branch 1 taken 10264 times.
✓ Branch 2 taken 10264 times.
✓ Branch 3 taken 479 times.
|
10743 | for(int32_t i=0; i<temp_map_count && i<MAXMAPS; i++) |
| 17483 | { | ||
| 17484 | 10264 | byte valid=1; | |
| 17485 |
2/2✓ Branch 0 taken 1642 times.
✓ Branch 1 taken 8622 times.
|
10264 | if(version > 22) |
| 17486 | { | ||
| 17487 |
2/4✓ Branch 0 taken 1642 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1642 times.
✗ Branch 3 not taken.
|
1642 | if(!p_getc(&valid,f)) |
| 17488 | ✗ | return qe_invalid; | |
| 17489 | 1642 | } | |
| 17490 |
2/2✓ Branch 0 taken 133 times.
✓ Branch 1 taken 10131 times.
|
10264 | if(valid) |
| 17491 | { | ||
| 17492 |
2/2✓ Branch 0 taken 8752 times.
✓ Branch 1 taken 1379 times.
|
10131 | if (version > 25) |
| 17493 | { | ||
| 17494 |
2/2✓ Branch 0 taken 8274 times.
✓ Branch 1 taken 1379 times.
|
9653 | for(int q = 0; q < 6; ++q) |
| 17495 | { | ||
| 17496 |
2/4✓ Branch 0 taken 8274 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 8274 times.
✗ Branch 3 not taken.
|
8274 | if(!p_igetw(&map_autolayers[i*6+q],f)) |
| 17497 | ✗ | return qe_invalid; | |
| 17498 | 8274 | } | |
| 17499 | 1379 | } | |
| 17500 | |||
| 17501 |
2/2✓ Branch 0 taken 9194 times.
✓ Branch 1 taken 937 times.
|
10131 | if (version >= 31) |
| 17502 | { | ||
| 17503 | static regions_data tmp_rd; | ||
| 17504 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 937 times.
|
937 | regions_data& rd = should_skip ? tmp_rd : Regions[i]; |
| 17505 |
2/2✓ Branch 0 taken 7496 times.
✓ Branch 1 taken 937 times.
|
8433 | for(int32_t j=0; j<8; j++) |
| 17506 | { | ||
| 17507 |
2/2✓ Branch 0 taken 59968 times.
✓ Branch 1 taken 7496 times.
|
67464 | for(int32_t k=0; k<8; k++) |
| 17508 | { | ||
| 17509 |
2/4✓ Branch 0 taken 59968 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 59968 times.
✗ Branch 3 not taken.
|
59968 | if(!p_getc(&rd.region_ids[j][k],f)) |
| 17510 | { | ||
| 17511 | ✗ | return qe_invalid; | |
| 17512 | } | ||
| 17513 | 59968 | } | |
| 17514 | 7496 | } | |
| 17515 | 937 | } | |
| 17516 | 10131 | } | |
| 17517 |
2/2✓ Branch 0 taken 1395232 times.
✓ Branch 1 taken 10264 times.
|
1405496 | for(int32_t j=0; j<screens_to_read; j++) |
| 17518 | { | ||
| 17519 | 1395232 | screen=i*MAPSCRS+j; | |
| 17520 |
2/2✓ Branch 0 taken 272 times.
✓ Branch 1 taken 1394960 times.
|
1395232 | mapscr* scr = should_skip ? &temp_mapscr : &TheMaps[screen]; |
| 17521 | 1395232 | scr->map = i; | |
| 17522 | 1395232 | scr->screen = j; | |
| 17523 |
2/2✓ Branch 0 taken 1377144 times.
✓ Branch 1 taken 18088 times.
|
1395232 | if(valid) |
| 17524 |
1/2✓ Branch 0 taken 1377144 times.
✗ Branch 1 not taken.
|
1377144 | readmapscreen(f, Header, scr, version, screen); |
| 17525 |
1/2✓ Branch 0 taken 18088 times.
✗ Branch 1 not taken.
|
18088 | else if (!should_skip) |
| 17526 |
1/2✓ Branch 0 taken 18088 times.
✗ Branch 1 not taken.
|
18088 | clear_screen(scr); |
| 17527 | 1395232 | } | |
| 17528 | |||
| 17529 |
2/2✓ Branch 0 taken 10262 times.
✓ Branch 1 taken 2 times.
|
10264 | if (should_skip) |
| 17530 | 2 | continue; | |
| 17531 | |||
| 17532 |
5/6✓ Branch 0 taken 10094 times.
✓ Branch 1 taken 168 times.
✓ Branch 2 taken 18 times.
✓ Branch 3 taken 10076 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 18 times.
|
10262 | if((Header->zelda_version < 0x192)||((Header->zelda_version == 0x192)&&(Header->build<137))) |
| 17533 | { | ||
| 17534 | 168 | int32_t index = (i*MAPSCRS+132); | |
| 17535 | |||
| 17536 |
1/2✓ Branch 0 taken 168 times.
✗ Branch 1 not taken.
|
168 | TheMaps[index]=TheMaps[index-1]; |
| 17537 | |||
| 17538 | 168 | MEMCPY_ARR(TheMaps[i*MAPSCRS+132].data, TheMaps[i*MAPSCRS+131].data); | |
| 17539 | 168 | MEMCPY_ARR(TheMaps[i*MAPSCRS+132].sflag, TheMaps[i*MAPSCRS+131].sflag); | |
| 17540 | 168 | MEMCPY_ARR(TheMaps[i*MAPSCRS+132].cset, TheMaps[i*MAPSCRS+131].cset); | |
| 17541 | |||
| 17542 |
2/2✓ Branch 0 taken 504 times.
✓ Branch 1 taken 168 times.
|
672 | for(int32_t j=133; j<MAPSCRS; j++) |
| 17543 | { | ||
| 17544 | 504 | screen=i*MAPSCRS+j; | |
| 17545 | |||
| 17546 |
1/2✓ Branch 0 taken 504 times.
✗ Branch 1 not taken.
|
504 | TheMaps[screen].zero_memory(); |
| 17547 | 504 | TheMaps[screen].valid = mVERSION; | |
| 17548 | 504 | TheMaps[screen].screen_midi = -1; | |
| 17549 | 504 | TheMaps[screen].csensitive = 1; | |
| 17550 | 504 | } | |
| 17551 | 168 | } | |
| 17552 | |||
| 17553 |
5/6✓ Branch 0 taken 10094 times.
✓ Branch 1 taken 168 times.
✓ Branch 2 taken 18 times.
✓ Branch 3 taken 10076 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 18 times.
|
10262 | if((Header->zelda_version < 0x192)||((Header->zelda_version == 0x192)&&(Header->build<154))) |
| 17554 | { | ||
| 17555 |
2/2✓ Branch 0 taken 22848 times.
✓ Branch 1 taken 168 times.
|
23016 | for(int32_t j=0; j<MAPSCRS; j++) |
| 17556 | { | ||
| 17557 | 22848 | screen=i*MAPSCRS+j; | |
| 17558 |
1/2✓ Branch 0 taken 22848 times.
✗ Branch 1 not taken.
|
22848 | TheMaps[screen].door_combo_set=MakeDoors(i, j); |
| 17559 | |||
| 17560 |
2/2✓ Branch 0 taken 2924544 times.
✓ Branch 1 taken 22848 times.
|
2947392 | for(int32_t k=0; k<128; k++) |
| 17561 | { | ||
| 17562 |
1/2✓ Branch 0 taken 2924544 times.
✗ Branch 1 not taken.
|
2924544 | TheMaps[screen].secretcset[k]=tcmbcset2(i, TheMaps[screen].secretcombo[k]); |
| 17563 |
1/2✓ Branch 0 taken 2924544 times.
✗ Branch 1 not taken.
|
2924544 | TheMaps[screen].secretflag[k]=tcmbflag2(i, TheMaps[screen].secretcombo[k]); |
| 17564 |
1/2✓ Branch 0 taken 2924544 times.
✗ Branch 1 not taken.
|
2924544 | TheMaps[screen].secretcombo[k]=tcmbdat2(i, j, TheMaps[screen].secretcombo[k]); |
| 17565 | 2924544 | } | |
| 17566 | 22848 | } | |
| 17567 | 168 | } | |
| 17568 | 10262 | } | |
| 17569 | 479 | map_count = temp_map_count; | |
| 17570 | 479 | return 0; | |
| 17571 | 479 | } | |
| 17572 | |||
| 17573 | |||
| 17574 | 8972352 | void update_combo(newcombo& cmb, word section_version) | |
| 17575 | { | ||
| 17576 |
2/2✓ Branch 0 taken 1355533 times.
✓ Branch 1 taken 7616819 times.
|
8972352 | if(section_version < 40) |
| 17577 | { | ||
| 17578 |
3/3✓ Branch 0 taken 5114 times.
✓ Branch 1 taken 44442 times.
✓ Branch 2 taken 7567263 times.
|
7616819 | switch(cmb.type) |
| 17579 | { | ||
| 17580 | case cWATER: case cSHALLOWWATER: | ||
| 17581 | 44442 | cmb.attribytes[6] = iwRipples; | |
| 17582 | 44442 | break; | |
| 17583 | case cTALLGRASS: case cTALLGRASSNEXT: case cTALLGRASSTOUCHY: | ||
| 17584 | 5114 | cmb.attribytes[6] = iwTallGrass; | |
| 17585 | 5114 | break; | |
| 17586 | } | ||
| 17587 | 7616819 | } | |
| 17588 |
2/2✓ Branch 0 taken 1008102 times.
✓ Branch 1 taken 7964250 times.
|
8972352 | if(section_version < 49) |
| 17589 | { | ||
| 17590 |
4/4✓ Branch 0 taken 7930271 times.
✓ Branch 1 taken 33979 times.
✓ Branch 2 taken 15271 times.
✓ Branch 3 taken 7915000 times.
|
7964250 | if(cmb.type == cWATER || cmb.type == cSHALLOWWATER) |
| 17591 | 49250 | cmb.sfx_landing = WAV_ZN1SPLASH; | |
| 17592 | 7964250 | } | |
| 17593 | 8972352 | } | |
| 17594 | 287 | int32_t readcombos_old(word section_version, PACKFILE *f, zquestheader *, word version, word build, word start_combo, word max_combos) | |
| 17595 | { | ||
| 17596 |
2/2✓ Branch 0 taken 263 times.
✓ Branch 1 taken 24 times.
|
287 | bool should_skip = legacy_skip_flags && get_bit(legacy_skip_flags, skip_combos); |
| 17597 | byte tempbyte; | ||
| 17598 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 286 times.
|
287 | if (!should_skip) |
| 17599 | { | ||
| 17600 | 286 | reset_all_combo_animations(); | |
| 17601 | 286 | init_combo_classes(); | |
| 17602 | 286 | } | |
| 17603 | |||
| 17604 | // combos | ||
| 17605 | 287 | word combos_used=0; | |
| 17606 | int32_t dummy; | ||
| 17607 | byte padding; | ||
| 17608 | 287 | newcombo temp_combo; | |
| 17609 | |||
| 17610 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 286 times.
|
287 | if (!should_skip) |
| 17611 |
2/2✓ Branch 0 taken 18670080 times.
✓ Branch 1 taken 286 times.
|
18670366 | for(int32_t q = start_combo; q < start_combo+max_combos; ++q) |
| 17612 |
1/2✓ Branch 0 taken 18670080 times.
✗ Branch 1 not taken.
|
18670366 | combobuf[q].clear(); |
| 17613 | |||
| 17614 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 287 times.
|
287 | if(version < 0x174) |
| 17615 | { | ||
| 17616 | ✗ | combos_used=1024; | |
| 17617 | ✗ | } | |
| 17618 |
2/2✓ Branch 0 taken 269 times.
✓ Branch 1 taken 18 times.
|
287 | else if(version < 0x191) |
| 17619 | { | ||
| 17620 | 18 | combos_used=2048; | |
| 17621 | 18 | } | |
| 17622 | else | ||
| 17623 | { | ||
| 17624 |
2/4✓ Branch 0 taken 269 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 269 times.
✗ Branch 3 not taken.
|
269 | if(!p_igetw(&combos_used,f)) |
| 17625 | { | ||
| 17626 | ✗ | return qe_invalid; | |
| 17627 | } | ||
| 17628 | } | ||
| 17629 | |||
| 17630 | //finally... section data | ||
| 17631 |
2/2✓ Branch 0 taken 7481803 times.
✓ Branch 1 taken 287 times.
|
7482090 | for(int32_t i=0; i<combos_used; i++) |
| 17632 | { | ||
| 17633 |
1/2✓ Branch 0 taken 7481803 times.
✗ Branch 1 not taken.
|
7481803 | temp_combo.clear(); |
| 17634 |
1/2✓ Branch 0 taken 7481803 times.
✗ Branch 1 not taken.
|
7481803 | combo_trigger& temp_trigger = temp_combo.triggers.emplace_back(); |
| 17635 | 7481803 | int32_t temp_trigflags[6] = {0}; | |
| 17636 | |||
| 17637 |
2/2✓ Branch 0 taken 137768 times.
✓ Branch 1 taken 7344035 times.
|
7481803 | if ( section_version >= 11 ) |
| 17638 | { | ||
| 17639 |
2/4✓ Branch 0 taken 137768 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 137768 times.
✗ Branch 3 not taken.
|
137768 | if(!p_igetl(&temp_combo.tile,f)) |
| 17640 | { | ||
| 17641 | ✗ | return qe_invalid; | |
| 17642 | } | ||
| 17643 | 137768 | } | |
| 17644 | else | ||
| 17645 | { | ||
| 17646 |
2/4✓ Branch 0 taken 7344035 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 7344035 times.
✗ Branch 3 not taken.
|
7344035 | if(!p_igetw(&temp_combo.tile,f)) |
| 17647 | { | ||
| 17648 | ✗ | return qe_invalid; | |
| 17649 | } | ||
| 17650 | } | ||
| 17651 | 7481803 | temp_combo.o_tile = temp_combo.tile; | |
| 17652 |
2/4✓ Branch 0 taken 7481803 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 7481803 times.
✗ Branch 3 not taken.
|
7481803 | if(!p_getc(&temp_combo.flip,f)) |
| 17653 | { | ||
| 17654 | ✗ | return qe_invalid; | |
| 17655 | } | ||
| 17656 | |||
| 17657 |
2/4✓ Branch 0 taken 7481803 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 7481803 times.
✗ Branch 3 not taken.
|
7481803 | if(!p_getc(&temp_combo.walk,f)) |
| 17658 | { | ||
| 17659 | ✗ | return qe_invalid; | |
| 17660 | } | ||
| 17661 | |||
| 17662 |
2/4✓ Branch 0 taken 7481803 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 7481803 times.
✗ Branch 3 not taken.
|
7481803 | if(!p_getc(&temp_combo.type,f)) |
| 17663 | { | ||
| 17664 | ✗ | return qe_invalid; | |
| 17665 | } | ||
| 17666 | |||
| 17667 |
2/4✓ Branch 0 taken 7481803 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 7481803 times.
✗ Branch 3 not taken.
|
7481803 | if(!p_getc(&temp_combo.csets,f)) |
| 17668 | { | ||
| 17669 | ✗ | return qe_invalid; | |
| 17670 | } | ||
| 17671 | |||
| 17672 |
2/2✓ Branch 0 taken 69774 times.
✓ Branch 1 taken 7412029 times.
|
7481803 | if(version < 0x193) |
| 17673 | { | ||
| 17674 |
2/4✓ Branch 0 taken 69774 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 69774 times.
✗ Branch 3 not taken.
|
69774 | if(!p_getc(&padding,f)) |
| 17675 | ✗ | return qe_invalid; | |
| 17676 | |||
| 17677 |
2/4✓ Branch 0 taken 69774 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 69774 times.
✗ Branch 3 not taken.
|
69774 | if(!p_getc(&padding,f)) |
| 17678 | ✗ | return qe_invalid; | |
| 17679 | |||
| 17680 |
2/2✓ Branch 0 taken 32910 times.
✓ Branch 1 taken 36864 times.
|
69774 | if(version < 0x192) |
| 17681 | { | ||
| 17682 |
1/2✓ Branch 0 taken 36864 times.
✗ Branch 1 not taken.
|
36864 | if(version == 0x191) |
| 17683 | { | ||
| 17684 | ✗ | for(int32_t tmpcounter=0; tmpcounter<16; tmpcounter++) | |
| 17685 | { | ||
| 17686 | ✗ | if(!p_getc(&padding,f)) | |
| 17687 | ✗ | return qe_invalid; | |
| 17688 | ✗ | } | |
| 17689 | ✗ | } | |
| 17690 | 36864 | } | |
| 17691 | 69774 | } | |
| 17692 |
2/2✓ Branch 0 taken 7444939 times.
✓ Branch 1 taken 36864 times.
|
7481803 | if(version >= 0x192) |
| 17693 | { | ||
| 17694 |
2/4✓ Branch 0 taken 7444939 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 7444939 times.
✗ Branch 3 not taken.
|
7444939 | if(!p_getc(&temp_combo.frames,f)) |
| 17695 | ✗ | return qe_invalid; | |
| 17696 | |||
| 17697 |
2/4✓ Branch 0 taken 7444939 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 7444939 times.
✗ Branch 3 not taken.
|
7444939 | if(!p_getc(&temp_combo.speed,f)) |
| 17698 | ✗ | return qe_invalid; | |
| 17699 | |||
| 17700 |
2/4✓ Branch 0 taken 7444939 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 7444939 times.
✗ Branch 3 not taken.
|
7444939 | if(!p_igetw(&temp_combo.nextcombo,f)) |
| 17701 | ✗ | return qe_invalid; | |
| 17702 | |||
| 17703 |
2/4✓ Branch 0 taken 7444939 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 7444939 times.
✗ Branch 3 not taken.
|
7444939 | if(!p_getc(&temp_combo.nextcset,f)) |
| 17704 | ✗ | return qe_invalid; | |
| 17705 | |||
| 17706 | //Base flag | ||
| 17707 |
2/2✓ Branch 0 taken 4556531 times.
✓ Branch 1 taken 2888408 times.
|
7444939 | if(section_version>=3) |
| 17708 |
2/4✓ Branch 0 taken 4556531 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4556531 times.
✗ Branch 3 not taken.
|
4556531 | if(!p_getc(&temp_combo.flag,f)) |
| 17709 | ✗ | return qe_invalid; | |
| 17710 | |||
| 17711 |
2/2✓ Branch 0 taken 4556531 times.
✓ Branch 1 taken 2888408 times.
|
7444939 | if(section_version>=4) |
| 17712 | { | ||
| 17713 |
2/4✓ Branch 0 taken 4556531 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4556531 times.
✗ Branch 3 not taken.
|
4556531 | if(!p_getc(&temp_combo.skipanim,f)) |
| 17714 | ✗ | return qe_invalid; | |
| 17715 | |||
| 17716 |
2/4✓ Branch 0 taken 4556531 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4556531 times.
✗ Branch 3 not taken.
|
4556531 | if(!p_igetw(&temp_combo.nexttimer,f)) |
| 17717 | ✗ | return qe_invalid; | |
| 17718 | 4556531 | } | |
| 17719 | |||
| 17720 |
2/2✓ Branch 0 taken 4556531 times.
✓ Branch 1 taken 2888408 times.
|
7444939 | if(section_version>=5) |
| 17721 |
2/4✓ Branch 0 taken 4556531 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4556531 times.
✗ Branch 3 not taken.
|
4556531 | if(!p_getc(&temp_combo.skipanimy,f)) |
| 17722 | ✗ | return qe_invalid; | |
| 17723 | |||
| 17724 |
2/2✓ Branch 0 taken 4556531 times.
✓ Branch 1 taken 2888408 times.
|
7444939 | if(section_version>=6) |
| 17725 | { | ||
| 17726 |
2/4✓ Branch 0 taken 4556531 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4556531 times.
✗ Branch 3 not taken.
|
4556531 | if(!p_getc(&temp_combo.animflags,f)) |
| 17727 | ✗ | return qe_invalid; | |
| 17728 | |||
| 17729 |
1/2✓ Branch 0 taken 4556531 times.
✗ Branch 1 not taken.
|
4556531 | if(section_version == 6) |
| 17730 | ✗ | temp_combo.animflags = temp_combo.animflags ? AF_FRESH : 0; | |
| 17731 | 4556531 | } | |
| 17732 | |||
| 17733 |
2/2✓ Branch 0 taken 7307171 times.
✓ Branch 1 taken 137768 times.
|
7444939 | if(section_version>=8) //combo Attributes[4] and userflags. |
| 17734 | { | ||
| 17735 |
2/2✓ Branch 0 taken 137768 times.
✓ Branch 1 taken 551072 times.
|
688840 | for ( int32_t q = 0; q < NUM_COMBO_ATTRIBUTES; q++ ) |
| 17736 |
2/4✓ Branch 0 taken 551072 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 551072 times.
✗ Branch 3 not taken.
|
551072 | if(!p_igetl(&temp_combo.attributes[q],f)) |
| 17737 | ✗ | return qe_invalid; | |
| 17738 |
2/4✓ Branch 0 taken 137768 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 137768 times.
✗ Branch 3 not taken.
|
137768 | if(!p_igetl(&temp_combo.usrflags,f)) |
| 17739 | ✗ | return qe_invalid; | |
| 17740 |
1/2✓ Branch 0 taken 137768 times.
✗ Branch 1 not taken.
|
137768 | if(section_version >= 20) |
| 17741 |
2/4✓ Branch 0 taken 137768 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 137768 times.
✗ Branch 3 not taken.
|
137768 | if(!p_igetw(&temp_combo.genflags,f)) |
| 17742 | ✗ | return qe_invalid; | |
| 17743 | 137768 | } | |
| 17744 |
2/2✓ Branch 0 taken 137768 times.
✓ Branch 1 taken 7307171 times.
|
7444939 | if(section_version>=10) //combo trigger flags |
| 17745 | { | ||
| 17746 |
2/2✓ Branch 0 taken 413304 times.
✓ Branch 1 taken 137768 times.
|
551072 | for ( int32_t q = 0; q < 3; q++ ) |
| 17747 |
2/4✓ Branch 0 taken 413304 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 413304 times.
✗ Branch 3 not taken.
|
413304 | if(!p_igetl(&temp_trigflags[q],f)) |
| 17748 | ✗ | return qe_invalid; | |
| 17749 | 137768 | } | |
| 17750 |
1/2✓ Branch 0 taken 7307171 times.
✗ Branch 1 not taken.
|
7307171 | else if(section_version==9) //combo trigger flags, V9 only had two indices |
| 17751 | { | ||
| 17752 | ✗ | for ( int32_t q = 0; q < 2; q++ ) | |
| 17753 | ✗ | if(!p_igetl(&temp_trigflags[q],f)) | |
| 17754 | ✗ | return qe_invalid; | |
| 17755 | ✗ | } | |
| 17756 |
2/2✓ Branch 0 taken 137768 times.
✓ Branch 1 taken 7307171 times.
|
7444939 | if(section_version >= 9) |
| 17757 |
2/4✓ Branch 0 taken 137768 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 137768 times.
✗ Branch 3 not taken.
|
137768 | if(!p_igetl(&temp_trigger.triggerlevel,f)) |
| 17758 | ✗ | return qe_invalid; | |
| 17759 |
2/2✓ Branch 0 taken 137768 times.
✓ Branch 1 taken 7307171 times.
|
7444939 | if(section_version >= 22) |
| 17760 |
2/4✓ Branch 0 taken 137768 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 137768 times.
✗ Branch 3 not taken.
|
137768 | if(!p_getc(&temp_trigger.triggerbtn,f)) |
| 17761 | ✗ | return qe_invalid; | |
| 17762 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 7444939 times.
|
7444939 | if(section_version >= 24) |
| 17763 | { | ||
| 17764 | ✗ | if(!p_getc(&temp_trigger.triggeritem,f)) | |
| 17765 | ✗ | return qe_invalid; | |
| 17766 | ✗ | if(!p_getc(&tempbyte, f)) | |
| 17767 | ✗ | return qe_invalid; | |
| 17768 | ✗ | temp_trigger.trigtimer = tempbyte; | |
| 17769 | ✗ | } | |
| 17770 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 7444939 times.
|
7444939 | if(section_version >= 25) |
| 17771 | ✗ | if(!p_getc(&temp_trigger.trigsfx,f)) | |
| 17772 | ✗ | return qe_invalid; | |
| 17773 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 7444939 times.
|
7444939 | if(section_version >= 27) |
| 17774 | ✗ | if(!p_igetl(&temp_trigger.trigchange,f)) | |
| 17775 | ✗ | return qe_invalid; | |
| 17776 | |||
| 17777 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 7444939 times.
|
7444939 | if(section_version >= 29) |
| 17778 | { | ||
| 17779 | ✗ | if(!p_igetw(&temp_trigger.trigprox,f)) | |
| 17780 | ✗ | return qe_invalid; | |
| 17781 | ✗ | if(!p_getc(&tempbyte,f)) | |
| 17782 | ✗ | return qe_invalid; | |
| 17783 | ✗ | temp_trigger.trigctr = tempbyte; | |
| 17784 | ✗ | if(!p_igetl(&temp_trigger.trigctramnt,f)) | |
| 17785 | ✗ | return qe_invalid; | |
| 17786 | ✗ | } | |
| 17787 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 7444939 times.
|
7444939 | if(section_version >= 30) |
| 17788 | ✗ | if(!p_getc(&temp_trigger.triglbeam,f)) | |
| 17789 | ✗ | return qe_invalid; | |
| 17790 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 7444939 times.
|
7444939 | if(section_version >= 31) |
| 17791 | { | ||
| 17792 | ✗ | if(!p_getc(&temp_trigger.trigcschange,f)) | |
| 17793 | ✗ | return qe_invalid; | |
| 17794 | ✗ | if(!p_igetw(&temp_trigger.spawnitem,f)) | |
| 17795 | ✗ | return qe_invalid; | |
| 17796 | ✗ | if(!p_igetw(&temp_trigger.spawnenemy,f)) | |
| 17797 | ✗ | return qe_invalid; | |
| 17798 | ✗ | if(!p_getc(&temp_trigger.exstate,f)) | |
| 17799 | ✗ | return qe_invalid; | |
| 17800 | ✗ | if(!p_igetl(&temp_trigger.spawnip,f)) | |
| 17801 | ✗ | return qe_invalid; | |
| 17802 | ✗ | if(!p_getc(&temp_trigger.trigcopycat,f)) | |
| 17803 | ✗ | return qe_invalid; | |
| 17804 | ✗ | } | |
| 17805 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 7444939 times.
|
7444939 | if(section_version >= 32) |
| 17806 | ✗ | if(!p_getc(&temp_trigger.trigcooldown,f)) | |
| 17807 | ✗ | return qe_invalid; | |
| 17808 | |||
| 17809 |
2/2✓ Branch 0 taken 7307171 times.
✓ Branch 1 taken 137768 times.
|
7444939 | if(section_version>=12) //combo label |
| 17810 | { | ||
| 17811 | char label[12]; | ||
| 17812 | 137768 | label[11] = '\0'; | |
| 17813 |
2/2✓ Branch 0 taken 137768 times.
✓ Branch 1 taken 1515448 times.
|
1653216 | for ( int32_t q = 0; q < 11; q++ ) |
| 17814 |
2/4✓ Branch 0 taken 1515448 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1515448 times.
✗ Branch 3 not taken.
|
1515448 | if(!p_getc(&label[q],f)) |
| 17815 | ✗ | return qe_invalid; | |
| 17816 |
1/2✓ Branch 0 taken 137768 times.
✗ Branch 1 not taken.
|
137768 | temp_combo.label = label; |
| 17817 | 137768 | } | |
| 17818 |
2/2✓ Branch 0 taken 7307171 times.
✓ Branch 1 taken 137768 times.
|
7444939 | if(section_version>=13) //attribytes[4] |
| 17819 |
2/2✓ Branch 0 taken 551072 times.
✓ Branch 1 taken 137768 times.
|
688840 | for ( int32_t q = 0; q < 4; q++ ) |
| 17820 |
2/4✓ Branch 0 taken 551072 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 551072 times.
✗ Branch 3 not taken.
|
551072 | if(!p_getc(&temp_combo.attribytes[q],f)) |
| 17821 | 137768 | return qe_invalid; | |
| 17822 | /* HIGHLY UNORTHODOX UPDATING THING, by Deedee | ||
| 17823 | * This fixes a poor implementation of a ->next flag bug thing. | ||
| 17824 | * Zoria didn't bump up the versions as liberally as he should have, but thankfully | ||
| 17825 | * there was a version bump a few weeks before a change that broke stuff. | ||
| 17826 | */ | ||
| 17827 |
3/4✓ Branch 0 taken 137768 times.
✓ Branch 1 taken 7307171 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 137768 times.
|
7444939 | if (section_version >= 13 && section_version < 21) |
| 17828 | { | ||
| 17829 | ✗ | set_qr(qr_BUGGY_BUGGY_SLASH_TRIGGERS,1); | |
| 17830 | ✗ | } | |
| 17831 | //combo scripts | ||
| 17832 |
2/2✓ Branch 0 taken 137768 times.
✓ Branch 1 taken 7307171 times.
|
7444939 | if(section_version>=14) |
| 17833 | { | ||
| 17834 |
2/4✓ Branch 0 taken 137768 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 137768 times.
✗ Branch 3 not taken.
|
137768 | if(!p_igetw(&temp_combo.script,f)) |
| 17835 | ✗ | return qe_invalid; | |
| 17836 |
2/2✓ Branch 0 taken 275536 times.
✓ Branch 1 taken 137768 times.
|
413304 | for ( int32_t q = 0; q < 2; q++ ) |
| 17837 |
2/4✓ Branch 0 taken 275536 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 275536 times.
✗ Branch 3 not taken.
|
275536 | if(!p_igetl(&temp_combo.initd[q],f)) |
| 17838 | ✗ | return qe_invalid; | |
| 17839 | 137768 | } | |
| 17840 |
2/2✓ Branch 0 taken 137768 times.
✓ Branch 1 taken 7307171 times.
|
7444939 | if(section_version>=15) |
| 17841 | { | ||
| 17842 |
2/4✓ Branch 0 taken 137768 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 137768 times.
✗ Branch 3 not taken.
|
137768 | if(!p_igetl(&temp_combo.o_tile,f)) return qe_invalid; |
| 17843 |
2/2✓ Branch 0 taken 74056 times.
✓ Branch 1 taken 63712 times.
|
137768 | if(!temp_combo.o_tile) temp_combo.o_tile = temp_combo.tile; |
| 17844 |
2/4✓ Branch 0 taken 137768 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 137768 times.
✗ Branch 3 not taken.
|
137768 | if(!p_getc(&temp_combo.cur_frame,f)) return qe_invalid; |
| 17845 |
2/4✓ Branch 0 taken 137768 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 137768 times.
✗ Branch 3 not taken.
|
137768 | if(!p_getc(&temp_combo.aclk,f)) return qe_invalid; |
| 17846 | 137768 | } | |
| 17847 |
2/2✓ Branch 0 taken 7307171 times.
✓ Branch 1 taken 137768 times.
|
7444939 | if(section_version>=17) //attribytes[4] |
| 17848 | { | ||
| 17849 |
2/2✓ Branch 0 taken 551072 times.
✓ Branch 1 taken 137768 times.
|
688840 | for ( int32_t q = 4; q < 8; q++ ) //bump up attribytes... |
| 17850 |
2/4✓ Branch 0 taken 551072 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 551072 times.
✗ Branch 3 not taken.
|
551072 | if(!p_getc(&temp_combo.attribytes[q],f)) |
| 17851 | ✗ | return qe_invalid; | |
| 17852 |
2/2✓ Branch 0 taken 1102144 times.
✓ Branch 1 taken 137768 times.
|
1239912 | for ( int32_t q = 0; q < 8; q++ ) //...and add attrishorts |
| 17853 |
2/4✓ Branch 0 taken 1102144 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1102144 times.
✗ Branch 3 not taken.
|
1102144 | if(!p_igetw(&temp_combo.attrishorts[q],f)) |
| 17854 | ✗ | return qe_invalid; | |
| 17855 | 137768 | } | |
| 17856 | |||
| 17857 |
2/2✓ Branch 0 taken 7412029 times.
✓ Branch 1 taken 32910 times.
|
7444939 | if(version < 0x193) |
| 17858 |
2/2✓ Branch 0 taken 362010 times.
✓ Branch 1 taken 32910 times.
|
394920 | for(int32_t q=0; q<11; q++) |
| 17859 |
2/4✓ Branch 0 taken 362010 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 362010 times.
✗ Branch 3 not taken.
|
362010 | if(!p_getc(&dummy,f)) |
| 17860 | 32910 | return qe_invalid; | |
| 17861 | 7444939 | } | |
| 17862 | |||
| 17863 | //Goriya tiles were flipped around in 2.11 build 7. Compensate for the flip here. -DD | ||
| 17864 |
3/6✓ Branch 0 taken 4556531 times.
✓ Branch 1 taken 2925272 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 4556531 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
7481803 | if((version < 0x211)||((version == 0x211)&&(build<7))) |
| 17865 | { | ||
| 17866 |
2/2✓ Branch 0 taken 2885336 times.
✓ Branch 1 taken 39936 times.
|
2925272 | if(!get_qr(qr_NEWENEMYTILES)) |
| 17867 | { | ||
| 17868 |
1/5✓ Branch 0 taken 39936 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
|
39936 | switch(temp_combo.tile) |
| 17869 | { | ||
| 17870 | case 130: | ||
| 17871 | ✗ | temp_combo.tile = 132; | |
| 17872 | ✗ | break; | |
| 17873 | |||
| 17874 | case 131: | ||
| 17875 | ✗ | temp_combo.tile = 133; | |
| 17876 | ✗ | break; | |
| 17877 | |||
| 17878 | case 132: | ||
| 17879 | ✗ | temp_combo.tile = 130; | |
| 17880 | ✗ | break; | |
| 17881 | |||
| 17882 | case 133: | ||
| 17883 | ✗ | temp_combo.tile = 131; | |
| 17884 | ✗ | break; | |
| 17885 | } | ||
| 17886 | 39936 | } | |
| 17887 | 2925272 | } | |
| 17888 | |||
| 17889 |
2/2✓ Branch 0 taken 137768 times.
✓ Branch 1 taken 7344035 times.
|
7481803 | if(section_version < 15) |
| 17890 | 7344035 | temp_combo.o_tile = temp_combo.tile; | |
| 17891 | |||
| 17892 |
2/2✓ Branch 0 taken 137768 times.
✓ Branch 1 taken 7344035 times.
|
7481803 | if(section_version<18) //upper bits for .walk |
| 17893 | 7344035 | temp_combo.walk |= 0xF0; | |
| 17894 | |||
| 17895 |
2/2✓ Branch 0 taken 137768 times.
✓ Branch 1 taken 7344035 times.
|
7481803 | if(section_version < 19) |
| 17896 |
2/2✓ Branch 0 taken 29376140 times.
✓ Branch 1 taken 7344035 times.
|
36720175 | for(int32_t q = 0; q < 4; ++q) |
| 17897 | 36720175 | temp_combo.attributes[q] *= 10000L; | |
| 17898 | |||
| 17899 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 7481803 times.
|
7481803 | if(section_version < 23) |
| 17900 | { | ||
| 17901 |
2/2✓ Branch 0 taken 15208 times.
✓ Branch 1 taken 7466595 times.
|
7481803 | switch(temp_combo.type) //TRIGFLAG_CMBTYPEFX now required for combotype-specific effects |
| 17902 | { | ||
| 17903 | case cSCRIPT1: case cSCRIPT2: case cSCRIPT3: case cSCRIPT4: case cSCRIPT5: | ||
| 17904 | case cSCRIPT6: case cSCRIPT7: case cSCRIPT8: case cSCRIPT9: case cSCRIPT10: | ||
| 17905 | case cTRIGGERGENERIC: case cCSWITCH: | ||
| 17906 | 15208 | temp_trigflags[TRIGFLAG_CMBTYPEFX/32] |= 1<<(TRIGFLAG_CMBTYPEFX%32); | |
| 17907 | 15208 | } | |
| 17908 | 7481803 | } | |
| 17909 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 7481803 times.
|
7481803 | if(section_version < 25) |
| 17910 | { | ||
| 17911 |
2/2✓ Branch 0 taken 26628 times.
✓ Branch 1 taken 7455175 times.
|
7481803 | switch(temp_combo.type) |
| 17912 | { | ||
| 17913 | case cLOCKBLOCK: case cBOSSLOCKBLOCK: | ||
| 17914 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 26628 times.
|
26628 | if(!(temp_combo.usrflags & cflag3)) |
| 17915 | 26628 | temp_combo.attribytes[3] = WAV_DOOR; | |
| 17916 | 26628 | temp_combo.usrflags &= ~cflag3; | |
| 17917 | 26628 | break; | |
| 17918 | } | ||
| 17919 | 7481803 | } | |
| 17920 | |||
| 17921 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 7481803 times.
|
7481803 | if(section_version < 26) |
| 17922 |
2/2✓ Branch 0 taken 7480687 times.
✓ Branch 1 taken 1116 times.
|
7482919 | if(temp_combo.type == cARMOS) |
| 17923 |
1/2✓ Branch 0 taken 1116 times.
✗ Branch 1 not taken.
|
1116 | if(temp_combo.usrflags & cflag1) |
| 17924 | ✗ | temp_combo.usrflags |= cflag3; | |
| 17925 | |||
| 17926 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 7481803 times.
|
7481803 | if(section_version < 27) |
| 17927 | { | ||
| 17928 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 7481803 times.
|
7481803 | if(temp_trigflags[0] & 0x00040000) //'next' |
| 17929 | ✗ | temp_trigger.trigchange = 1; | |
| 17930 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 7481803 times.
|
7481803 | else if(temp_trigflags[0] & 0x00080000) //'prev' |
| 17931 | ✗ | temp_trigger.trigchange = -1; | |
| 17932 | 7481803 | else temp_trigger.trigchange = 0; | |
| 17933 | 7481803 | temp_trigflags[0] &= ~(0x00040000|0x00080000); | |
| 17934 | 7481803 | } | |
| 17935 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 7481803 times.
|
7481803 | if(section_version < 28) |
| 17936 | { | ||
| 17937 |
2/2✓ Branch 0 taken 15082 times.
✓ Branch 1 taken 7466721 times.
|
7481803 | switch(temp_combo.type) |
| 17938 | { | ||
| 17939 | case cLOCKBLOCK: case cLOCKEDCHEST: | ||
| 17940 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 15082 times.
|
15082 | if(temp_combo.usrflags & cflag7) |
| 17941 | ✗ | temp_combo.usrflags |= cflag8; | |
| 17942 | 15082 | else temp_combo.usrflags &= ~cflag8; | |
| 17943 | 15082 | temp_combo.usrflags &= ~cflag7; | |
| 17944 | 15082 | break; | |
| 17945 | } | ||
| 17946 |
2/2✓ Branch 0 taken 708 times.
✓ Branch 1 taken 7481095 times.
|
7481803 | switch(temp_combo.type) |
| 17947 | { | ||
| 17948 | case cCHEST: case cLOCKEDCHEST: case cBOSSCHEST: | ||
| 17949 | 708 | temp_combo.attrishorts[2] = -1; | |
| 17950 | 708 | temp_combo.usrflags |= cflag7; | |
| 17951 | 708 | break; | |
| 17952 | } | ||
| 17953 | 7481803 | } | |
| 17954 |
2/2✓ Branch 0 taken 137768 times.
✓ Branch 1 taken 7344035 times.
|
7481803 | if(section_version < 20) |
| 17955 | { | ||
| 17956 | 7344035 | temp_combo.genflags = 0; | |
| 17957 |
2/2✓ Branch 0 taken 143987 times.
✓ Branch 1 taken 7200048 times.
|
7344035 | switch(temp_combo.type) |
| 17958 | { | ||
| 17959 | case cPUSH_WAIT: case cPUSH_HEAVY: | ||
| 17960 | case cPUSH_HW: case cL_STATUE: | ||
| 17961 | case cR_STATUE: case cPUSH_HEAVY2: | ||
| 17962 | case cPUSH_HW2: case cPOUND: | ||
| 17963 | case cC_STATUE: case cMIRROR: | ||
| 17964 | case cMIRRORSLASH: case cMIRRORBACKSLASH: | ||
| 17965 | case cMAGICPRISM: case cMAGICPRISM4: | ||
| 17966 | case cMAGICSPONGE: case cEYEBALL_A: | ||
| 17967 | case cEYEBALL_B: case cEYEBALL_4: | ||
| 17968 | case cBUSH: case cFLOWERS: | ||
| 17969 | case cLOCKBLOCK: case cLOCKBLOCK2: | ||
| 17970 | case cBOSSLOCKBLOCK: case cBOSSLOCKBLOCK2: | ||
| 17971 | case cCHEST: case cCHEST2: | ||
| 17972 | case cLOCKEDCHEST: case cLOCKEDCHEST2: | ||
| 17973 | case cBOSSCHEST: case cBOSSCHEST2: | ||
| 17974 | case cBUSHNEXT: case cBUSHTOUCHY: | ||
| 17975 | case cFLOWERSTOUCHY: case cBUSHNEXTTOUCHY: | ||
| 17976 | case cSIGNPOST: case cCSWITCHBLOCK: | ||
| 17977 | case cTORCH: case cTRIGGERGENERIC: | ||
| 17978 |
1/2✓ Branch 0 taken 143987 times.
✗ Branch 1 not taken.
|
143987 | if(temp_combo.usrflags & cflag16) |
| 17979 | { | ||
| 17980 | ✗ | temp_combo.genflags |= cflag1; | |
| 17981 | ✗ | temp_combo.usrflags &= ~cflag16; | |
| 17982 | ✗ | } | |
| 17983 | 143987 | break; | |
| 17984 | } | ||
| 17985 | 7344035 | } | |
| 17986 | |||
| 17987 |
1/2✓ Branch 0 taken 7481803 times.
✗ Branch 1 not taken.
|
7481803 | temp_trigger.trigger_flags.clear(); |
| 17988 |
2/2✓ Branch 0 taken 7481803 times.
✓ Branch 1 taken 1436506176 times.
|
1443987979 | for(size_t q = 0; q < 32*6; ++q) |
| 17989 | { | ||
| 17990 | 1436506176 | auto ind = q/32; | |
| 17991 | 1436506176 | auto bit = 1<<(q%32); | |
| 17992 |
2/2✓ Branch 0 taken 1436490274 times.
✓ Branch 1 taken 15902 times.
|
1436506176 | if(temp_trigflags[ind] & bit) |
| 17993 |
1/2✓ Branch 0 taken 15902 times.
✗ Branch 1 not taken.
|
15902 | temp_trigger.trigger_flags.set(q, true); |
| 17994 | 1436506176 | } | |
| 17995 | |||
| 17996 |
3/4✓ Branch 0 taken 7481803 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 15234 times.
✓ Branch 3 taken 7466569 times.
|
7481803 | if(temp_trigger.is_blank()) |
| 17997 | 7466569 | temp_combo.triggers.clear(); | |
| 17998 | |||
| 17999 | 7481803 | update_combo(temp_combo, section_version); | |
| 18000 | |||
| 18001 |
3/4✓ Branch 0 taken 7481803 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 7466884 times.
✓ Branch 3 taken 14919 times.
|
7481803 | if(i>=start_combo && !should_skip) |
| 18002 | { | ||
| 18003 |
1/2✓ Branch 0 taken 7466884 times.
✗ Branch 1 not taken.
|
7466884 | if(loading_tileset_flags & TILESET_CLEARSCRIPTS) |
| 18004 | { | ||
| 18005 | ✗ | temp_combo.script = 0; | |
| 18006 | ✗ | for(int q = 0; q < 8; ++q) | |
| 18007 | ✗ | temp_combo.initd[q] = 0; | |
| 18008 | ✗ | } | |
| 18009 |
1/2✓ Branch 0 taken 7466884 times.
✗ Branch 1 not taken.
|
7466884 | combobuf[i] = temp_combo; |
| 18010 | 7466884 | } | |
| 18011 | 7481803 | } | |
| 18012 | |||
| 18013 |
2/2✓ Branch 0 taken 286 times.
✓ Branch 1 taken 1 times.
|
287 | if (should_skip) |
| 18014 | 1 | return 0; | |
| 18015 | |||
| 18016 |
5/6✓ Branch 0 taken 268 times.
✓ Branch 1 taken 18 times.
✓ Branch 2 taken 5 times.
✓ Branch 3 taken 263 times.
✓ Branch 4 taken 5 times.
✗ Branch 5 not taken.
|
286 | if((version < 0x192)|| ((version == 0x192)&&(build<185))) |
| 18017 | { | ||
| 18018 |
2/2✓ Branch 0 taken 1501440 times.
✓ Branch 1 taken 23 times.
|
1501463 | for(int32_t tmpcounter=0; tmpcounter<MAXCOMBOS; tmpcounter++) |
| 18019 | { | ||
| 18020 |
2/2✓ Branch 0 taken 1501225 times.
✓ Branch 1 taken 215 times.
|
1501440 | if(combobuf[tmpcounter].type==cHOOKSHOTONLY) |
| 18021 | { | ||
| 18022 | 215 | combobuf[tmpcounter].type=cLADDERHOOKSHOT; | |
| 18023 | 215 | } | |
| 18024 | 1501440 | } | |
| 18025 | 23 | } | |
| 18026 | |||
| 18027 | //June 3 2012; ladder only is broken in 2.10 and allows the hookshot also. -Gleeok | ||
| 18028 |
4/6✓ Branch 0 taken 59 times.
✓ Branch 1 taken 227 times.
✓ Branch 2 taken 59 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 59 times.
|
286 | if(version == 0x210 && get_app_id() != App::zquest) |
| 18029 | { | ||
| 18030 |
2/2✓ Branch 0 taken 3851520 times.
✓ Branch 1 taken 59 times.
|
3851579 | for(int32_t tmpcounter=0; tmpcounter<MAXCOMBOS; tmpcounter++) |
| 18031 |
2/2✓ Branch 0 taken 3851335 times.
✓ Branch 1 taken 185 times.
|
3851705 | if(combobuf[tmpcounter].type == cLADDERONLY) |
| 18032 | 185 | combobuf[tmpcounter].type = cLADDERHOOKSHOT; | |
| 18033 | 59 | } | |
| 18034 | |||
| 18035 |
2/2✓ Branch 0 taken 204 times.
✓ Branch 1 taken 82 times.
|
286 | if(section_version<7) |
| 18036 | { | ||
| 18037 |
2/2✓ Branch 0 taken 5352960 times.
✓ Branch 1 taken 82 times.
|
5353042 | for(int32_t tmpcounter=0; tmpcounter<MAXCOMBOS; tmpcounter++) |
| 18038 | { | ||
| 18039 |
6/9✓ Branch 0 taken 5350008 times.
✓ Branch 1 taken 853 times.
✓ Branch 2 taken 791 times.
✓ Branch 3 taken 603 times.
✓ Branch 4 taken 174 times.
✓ Branch 5 taken 531 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
|
5352960 | switch(combobuf[tmpcounter].type) |
| 18040 | { | ||
| 18041 | case cSLASH: | ||
| 18042 | 853 | combobuf[tmpcounter].type=cSLASHTOUCHY; | |
| 18043 | 853 | break; | |
| 18044 | |||
| 18045 | case cSLASHITEM: | ||
| 18046 | 791 | combobuf[tmpcounter].type=cSLASHITEMTOUCHY; | |
| 18047 | 791 | break; | |
| 18048 | |||
| 18049 | case cBUSH: | ||
| 18050 | 603 | combobuf[tmpcounter].type=cBUSHTOUCHY; | |
| 18051 | 603 | break; | |
| 18052 | |||
| 18053 | case cFLOWERS: | ||
| 18054 | 174 | combobuf[tmpcounter].type=cFLOWERSTOUCHY; | |
| 18055 | 174 | break; | |
| 18056 | |||
| 18057 | case cTALLGRASS: | ||
| 18058 | 531 | combobuf[tmpcounter].type=cTALLGRASSTOUCHY; | |
| 18059 | 531 | break; | |
| 18060 | |||
| 18061 | case cSLASHNEXT: | ||
| 18062 | ✗ | combobuf[tmpcounter].type=cSLASHNEXTTOUCHY; | |
| 18063 | ✗ | break; | |
| 18064 | |||
| 18065 | case cSLASHNEXTITEM: | ||
| 18066 | ✗ | combobuf[tmpcounter].type=cSLASHNEXTITEMTOUCHY; | |
| 18067 | ✗ | break; | |
| 18068 | |||
| 18069 | case cBUSHNEXT: | ||
| 18070 | ✗ | combobuf[tmpcounter].type=cBUSHNEXTTOUCHY; | |
| 18071 | ✗ | break; | |
| 18072 | } | ||
| 18073 | 5352960 | } | |
| 18074 | 82 | } | |
| 18075 |
2/2✓ Branch 0 taken 4 times.
✓ Branch 1 taken 282 times.
|
286 | if (section_version < 16) |
| 18076 | { | ||
| 18077 |
2/2✓ Branch 0 taken 18408960 times.
✓ Branch 1 taken 282 times.
|
18409242 | for(int32_t tmpcounter=0; tmpcounter<MAXCOMBOS; tmpcounter++) |
| 18078 | { | ||
| 18079 |
2/2✓ Branch 0 taken 18380119 times.
✓ Branch 1 taken 28841 times.
|
18408960 | if (combobuf[tmpcounter].type == cWATER) |
| 18080 | { | ||
| 18081 | 28841 | combobuf[tmpcounter].attributes[0] = 40000L; | |
| 18082 | 28841 | } | |
| 18083 | 18408960 | } | |
| 18084 | 282 | } | |
| 18085 |
2/2✓ Branch 0 taken 284 times.
✓ Branch 1 taken 2 times.
|
286 | if(!get_qr(qr_ALLOW_EDITING_COMBO_0)) |
| 18086 | { | ||
| 18087 | 2 | combobuf[0].walk = 0xF0; | |
| 18088 | 2 | combobuf[0].type = 0; | |
| 18089 | 2 | combobuf[0].flag = 0; | |
| 18090 | 2 | } | |
| 18091 | |||
| 18092 | //Now for the new combo alias reset | ||
| 18093 |
2/2✓ Branch 0 taken 204 times.
✓ Branch 1 taken 82 times.
|
286 | if(section_version<2) |
| 18094 | { | ||
| 18095 |
2/2✓ Branch 0 taken 671744 times.
✓ Branch 1 taken 82 times.
|
671826 | for(int32_t j=0; j<MAXCOMBOALIASES; j++) |
| 18096 | { | ||
| 18097 | 671744 | combo_aliases[j].width = 0; | |
| 18098 | 671744 | combo_aliases[j].height = 0; | |
| 18099 | 671744 | combo_aliases[j].layermask = 0; | |
| 18100 |
1/2✓ Branch 0 taken 671744 times.
✗ Branch 1 not taken.
|
671744 | combo_aliases[j].combos.clear(); |
| 18101 |
1/2✓ Branch 0 taken 671744 times.
✗ Branch 1 not taken.
|
671744 | combo_aliases[j].csets.clear(); |
| 18102 | 671744 | } | |
| 18103 | 82 | } | |
| 18104 | |||
| 18105 | |||
| 18106 |
1/2✓ Branch 0 taken 286 times.
✗ Branch 1 not taken.
|
286 | setup_combo_animations(); |
| 18107 |
1/2✓ Branch 0 taken 286 times.
✗ Branch 1 not taken.
|
286 | setup_combo_animations2(); |
| 18108 | 286 | return 0; | |
| 18109 | 287 | } | |
| 18110 | |||
| 18111 | 12912 | int32_t readcombo_triggers_loop(PACKFILE* f, word s_version, combo_trigger& temp_trigger) | |
| 18112 | { | ||
| 18113 | byte tempbyte; | ||
| 18114 |
2/2✓ Branch 0 taken 7621 times.
✓ Branch 1 taken 5291 times.
|
12912 | if(s_version >= 52) |
| 18115 |
1/2✓ Branch 0 taken 5291 times.
✗ Branch 1 not taken.
|
5291 | if(!p_getcstr(&temp_trigger.label,f)) |
| 18116 | ✗ | return qe_invalid; | |
| 18117 | |||
| 18118 |
2/2✓ Branch 0 taken 7867 times.
✓ Branch 1 taken 5045 times.
|
12912 | if(s_version < 57) |
| 18119 | { | ||
| 18120 | 7867 | int32_t temp_trigflags[6] = {0}; | |
| 18121 | 7867 | int numtrigs = s_version < 36 ? 3 : 6; | |
| 18122 |
2/2✓ Branch 0 taken 46344 times.
✓ Branch 1 taken 7867 times.
|
54211 | for ( int32_t q = 0; q < numtrigs; q++ ) |
| 18123 |
1/2✓ Branch 0 taken 46344 times.
✗ Branch 1 not taken.
|
46344 | if(!p_igetl(&temp_trigflags[q],f)) |
| 18124 | ✗ | return qe_invalid; | |
| 18125 | 7867 | temp_trigger.trigger_flags.clear(); | |
| 18126 |
2/2✓ Branch 0 taken 1483008 times.
✓ Branch 1 taken 7867 times.
|
1490875 | for(size_t q = 0; q < 32*numtrigs; ++q) |
| 18127 | { | ||
| 18128 | 1483008 | auto ind = q/32; | |
| 18129 | 1483008 | auto bit = 1<<(q%32); | |
| 18130 |
2/2✓ Branch 0 taken 1469513 times.
✓ Branch 1 taken 13495 times.
|
1483008 | if(temp_trigflags[ind] & bit) |
| 18131 | 13495 | temp_trigger.trigger_flags.set(q, true); | |
| 18132 | 1483008 | } | |
| 18133 | 7867 | } | |
| 18134 |
1/2✓ Branch 0 taken 5045 times.
✗ Branch 1 not taken.
|
5045 | else if(!p_getbitstr(&temp_trigger.trigger_flags,f)) |
| 18135 | ✗ | return qe_invalid; | |
| 18136 |
1/2✓ Branch 0 taken 12912 times.
✗ Branch 1 not taken.
|
12912 | if(!p_igetl(&temp_trigger.triggerlevel,f)) |
| 18137 | ✗ | return qe_invalid; | |
| 18138 |
1/2✓ Branch 0 taken 12912 times.
✗ Branch 1 not taken.
|
12912 | if(!p_getc(&temp_trigger.triggerbtn,f)) |
| 18139 | ✗ | return qe_invalid; | |
| 18140 |
1/2✓ Branch 0 taken 12912 times.
✗ Branch 1 not taken.
|
12912 | if(!p_getc(&temp_trigger.triggeritem,f)) |
| 18141 | ✗ | return qe_invalid; | |
| 18142 |
2/2✓ Branch 0 taken 5291 times.
✓ Branch 1 taken 7621 times.
|
12912 | if(s_version >= 53) |
| 18143 | { | ||
| 18144 |
1/2✓ Branch 0 taken 5291 times.
✗ Branch 1 not taken.
|
5291 | if(!p_igetw(&temp_trigger.trigtimer,f)) |
| 18145 | ✗ | return qe_invalid; | |
| 18146 | 5291 | } | |
| 18147 | else | ||
| 18148 | { | ||
| 18149 |
1/2✓ Branch 0 taken 7621 times.
✗ Branch 1 not taken.
|
7621 | if(!p_getc(&tempbyte, f)) |
| 18150 | ✗ | return qe_invalid; | |
| 18151 | 7621 | temp_trigger.trigtimer = tempbyte; | |
| 18152 | } | ||
| 18153 |
1/2✓ Branch 0 taken 12912 times.
✗ Branch 1 not taken.
|
12912 | if(!p_getc(&temp_trigger.trigsfx,f)) |
| 18154 | ✗ | return qe_invalid; | |
| 18155 |
1/2✓ Branch 0 taken 12912 times.
✗ Branch 1 not taken.
|
12912 | if(!p_igetl(&temp_trigger.trigchange,f)) |
| 18156 | ✗ | return qe_invalid; | |
| 18157 |
1/2✓ Branch 0 taken 12912 times.
✗ Branch 1 not taken.
|
12912 | if(!p_igetw(&temp_trigger.trigprox,f)) |
| 18158 | ✗ | return qe_invalid; | |
| 18159 |
2/2✓ Branch 0 taken 5291 times.
✓ Branch 1 taken 7621 times.
|
12912 | if(s_version >= 53) |
| 18160 | { | ||
| 18161 |
1/2✓ Branch 0 taken 5291 times.
✗ Branch 1 not taken.
|
5291 | if(!p_igetw(&temp_trigger.trigctr,f)) |
| 18162 | ✗ | return qe_invalid; | |
| 18163 | 5291 | } | |
| 18164 | else | ||
| 18165 | { | ||
| 18166 |
1/2✓ Branch 0 taken 7621 times.
✗ Branch 1 not taken.
|
7621 | if(!p_getc(&tempbyte,f)) |
| 18167 | ✗ | return qe_invalid; | |
| 18168 | 7621 | temp_trigger.trigctr = tempbyte; | |
| 18169 | } | ||
| 18170 |
1/2✓ Branch 0 taken 12912 times.
✗ Branch 1 not taken.
|
12912 | if(!p_igetl(&temp_trigger.trigctramnt,f)) |
| 18171 | ✗ | return qe_invalid; | |
| 18172 |
1/2✓ Branch 0 taken 12912 times.
✗ Branch 1 not taken.
|
12912 | if(!p_getc(&temp_trigger.triglbeam,f)) |
| 18173 | ✗ | return qe_invalid; | |
| 18174 |
1/2✓ Branch 0 taken 12912 times.
✗ Branch 1 not taken.
|
12912 | if(!p_getc(&temp_trigger.trigcschange,f)) |
| 18175 | ✗ | return qe_invalid; | |
| 18176 |
1/2✓ Branch 0 taken 12912 times.
✗ Branch 1 not taken.
|
12912 | if(!p_igetw(&temp_trigger.spawnitem,f)) |
| 18177 | ✗ | return qe_invalid; | |
| 18178 |
1/2✓ Branch 0 taken 12912 times.
✗ Branch 1 not taken.
|
12912 | if(!p_igetw(&temp_trigger.spawnenemy,f)) |
| 18179 | ✗ | return qe_invalid; | |
| 18180 |
1/2✓ Branch 0 taken 12912 times.
✗ Branch 1 not taken.
|
12912 | if(!p_getc(&temp_trigger.exstate,f)) |
| 18181 | ✗ | return qe_invalid; | |
| 18182 |
1/2✓ Branch 0 taken 12912 times.
✗ Branch 1 not taken.
|
12912 | if(!p_igetl(&temp_trigger.spawnip,f)) |
| 18183 | ✗ | return qe_invalid; | |
| 18184 |
1/2✓ Branch 0 taken 12912 times.
✗ Branch 1 not taken.
|
12912 | if(!p_getc(&temp_trigger.trigcopycat,f)) |
| 18185 | ✗ | return qe_invalid; | |
| 18186 |
1/2✓ Branch 0 taken 12912 times.
✗ Branch 1 not taken.
|
12912 | if(!p_getc(&temp_trigger.trigcooldown,f)) |
| 18187 | ✗ | return qe_invalid; | |
| 18188 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 12912 times.
|
12912 | if(s_version >= 35) |
| 18189 | { | ||
| 18190 |
1/2✓ Branch 0 taken 12912 times.
✗ Branch 1 not taken.
|
12912 | if(!p_igetw(&temp_trigger.prompt_cid,f)) |
| 18191 | ✗ | return qe_invalid; | |
| 18192 |
1/2✓ Branch 0 taken 12912 times.
✗ Branch 1 not taken.
|
12912 | if(!p_getc(&temp_trigger.prompt_cs,f)) |
| 18193 | ✗ | return qe_invalid; | |
| 18194 |
1/2✓ Branch 0 taken 12912 times.
✗ Branch 1 not taken.
|
12912 | if(!p_igetw(&temp_trigger.prompt_x,f)) |
| 18195 | ✗ | return qe_invalid; | |
| 18196 |
1/2✓ Branch 0 taken 12912 times.
✗ Branch 1 not taken.
|
12912 | if(!p_igetw(&temp_trigger.prompt_y,f)) |
| 18197 | ✗ | return qe_invalid; | |
| 18198 | 12912 | } | |
| 18199 |
2/2✓ Branch 0 taken 286 times.
✓ Branch 1 taken 12626 times.
|
12912 | if(s_version >= 36) |
| 18200 | { | ||
| 18201 |
1/2✓ Branch 0 taken 12626 times.
✗ Branch 1 not taken.
|
12626 | if(!p_getc(&temp_trigger.trig_lstate,f)) |
| 18202 | ✗ | return qe_invalid; | |
| 18203 |
1/2✓ Branch 0 taken 12626 times.
✗ Branch 1 not taken.
|
12626 | if(!p_getc(&temp_trigger.trig_gstate,f)) |
| 18204 | ✗ | return qe_invalid; | |
| 18205 |
1/2✓ Branch 0 taken 12626 times.
✗ Branch 1 not taken.
|
12626 | if(!p_igetl(&temp_trigger.trig_statetime,f)) |
| 18206 | ✗ | return qe_invalid; | |
| 18207 | 12626 | } | |
| 18208 |
2/2✓ Branch 0 taken 286 times.
✓ Branch 1 taken 12626 times.
|
12912 | if(s_version >= 37) |
| 18209 | { | ||
| 18210 |
1/2✓ Branch 0 taken 12626 times.
✗ Branch 1 not taken.
|
12626 | if(!p_igetw(&temp_trigger.trig_genscr,f)) |
| 18211 | ✗ | return qe_invalid; | |
| 18212 | 12626 | } | |
| 18213 |
2/2✓ Branch 0 taken 434 times.
✓ Branch 1 taken 12478 times.
|
12912 | if(s_version >= 38) |
| 18214 | { | ||
| 18215 |
1/2✓ Branch 0 taken 12478 times.
✗ Branch 1 not taken.
|
12478 | if(!p_getc(&temp_trigger.trig_group,f)) |
| 18216 | ✗ | return qe_invalid; | |
| 18217 |
1/2✓ Branch 0 taken 12478 times.
✗ Branch 1 not taken.
|
12478 | if(!p_igetw(&temp_trigger.trig_group_val,f)) |
| 18218 | ✗ | return qe_invalid; | |
| 18219 | 12478 | } | |
| 18220 |
2/2✓ Branch 0 taken 470 times.
✓ Branch 1 taken 12442 times.
|
12912 | if(s_version >= 45) |
| 18221 | { | ||
| 18222 |
1/2✓ Branch 0 taken 12442 times.
✗ Branch 1 not taken.
|
12442 | if(!p_getc(&temp_trigger.exdoor_dir,f)) |
| 18223 | ✗ | return qe_invalid; | |
| 18224 |
1/2✓ Branch 0 taken 12442 times.
✗ Branch 1 not taken.
|
12442 | if(!p_getc(&temp_trigger.exdoor_ind,f)) |
| 18225 | ✗ | return qe_invalid; | |
| 18226 | 12442 | } | |
| 18227 |
2/2✓ Branch 0 taken 7112 times.
✓ Branch 1 taken 5800 times.
|
12912 | if(s_version >= 46) |
| 18228 | { | ||
| 18229 |
1/2✓ Branch 0 taken 5800 times.
✗ Branch 1 not taken.
|
5800 | if(!p_getc(&temp_trigger.trig_levelitems,f)) |
| 18230 | ✗ | return qe_invalid; | |
| 18231 |
1/2✓ Branch 0 taken 5800 times.
✗ Branch 1 not taken.
|
5800 | if(!p_igetw(&temp_trigger.trigdmlevel,f)) |
| 18232 | ✗ | return qe_invalid; | |
| 18233 |
1/2✓ Branch 0 taken 5800 times.
✗ Branch 1 not taken.
|
5800 | if(s_version >= 48) |
| 18234 | { | ||
| 18235 |
2/2✓ Branch 0 taken 17400 times.
✓ Branch 1 taken 5800 times.
|
23200 | for(int q = 0; q < 3; ++q) |
| 18236 |
1/2✓ Branch 0 taken 17400 times.
✗ Branch 1 not taken.
|
17400 | if(!p_igetw(&temp_trigger.trigtint[q],f)) |
| 18237 | ✗ | return qe_invalid; | |
| 18238 | 5800 | } | |
| 18239 | else | ||
| 18240 | { | ||
| 18241 | ✗ | for(int q = 0; q < 3; ++q) | |
| 18242 | ✗ | if(!p_getc(&temp_trigger.trigtint[q],f)) | |
| 18243 | ✗ | return qe_invalid; | |
| 18244 | ✗ | for(int q = 0; q < 3; ++q) | |
| 18245 | { | ||
| 18246 | ✗ | int v = temp_trigger.trigtint[q]; | |
| 18247 | ✗ | int va = abs(v); | |
| 18248 | ✗ | temp_trigger.trigtint[q] = _rgb_scale_6[va] * sign(v); | |
| 18249 | ✗ | } | |
| 18250 | } | ||
| 18251 |
1/2✓ Branch 0 taken 5800 times.
✗ Branch 1 not taken.
|
5800 | if(!p_igetw(&temp_trigger.triglvlpalette,f)) |
| 18252 | ✗ | return qe_invalid; | |
| 18253 |
1/2✓ Branch 0 taken 5800 times.
✗ Branch 1 not taken.
|
5800 | if(!p_igetw(&temp_trigger.trigbosspalette,f)) |
| 18254 | ✗ | return qe_invalid; | |
| 18255 |
1/2✓ Branch 0 taken 5800 times.
✗ Branch 1 not taken.
|
5800 | if(!p_igetw(&temp_trigger.trigquaketime,f)) |
| 18256 | ✗ | return qe_invalid; | |
| 18257 |
1/2✓ Branch 0 taken 5800 times.
✗ Branch 1 not taken.
|
5800 | if(!p_igetw(&temp_trigger.trigwavytime,f)) |
| 18258 | ✗ | return qe_invalid; | |
| 18259 |
1/2✓ Branch 0 taken 5800 times.
✗ Branch 1 not taken.
|
5800 | if(!p_igetw(&temp_trigger.trig_swjinxtime,f)) |
| 18260 | ✗ | return qe_invalid; | |
| 18261 |
1/2✓ Branch 0 taken 5800 times.
✗ Branch 1 not taken.
|
5800 | if(!p_igetw(&temp_trigger.trig_itmjinxtime,f)) |
| 18262 | ✗ | return qe_invalid; | |
| 18263 |
1/2✓ Branch 0 taken 5800 times.
✗ Branch 1 not taken.
|
5800 | if(!p_igetw(&temp_trigger.trig_stuntime,f)) |
| 18264 | ✗ | return qe_invalid; | |
| 18265 |
1/2✓ Branch 0 taken 5800 times.
✗ Branch 1 not taken.
|
5800 | if(!p_igetw(&temp_trigger.trig_bunnytime,f)) |
| 18266 | ✗ | return qe_invalid; | |
| 18267 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 5800 times.
|
5800 | if(!p_getc(&temp_trigger.trig_pushtime,f)) |
| 18268 | ✗ | return qe_invalid; | |
| 18269 | 5800 | } | |
| 18270 |
2/2✓ Branch 0 taken 7112 times.
✓ Branch 1 taken 5800 times.
|
12912 | if(s_version >= 47) |
| 18271 | { | ||
| 18272 |
1/2✓ Branch 0 taken 5800 times.
✗ Branch 1 not taken.
|
5800 | if (!p_igetw(&temp_trigger.trig_shieldjinxtime, f)) |
| 18273 | ✗ | return qe_invalid; | |
| 18274 | 5800 | } | |
| 18275 |
2/2✓ Branch 0 taken 5291 times.
✓ Branch 1 taken 7621 times.
|
12912 | if(s_version >= 53) |
| 18276 | { | ||
| 18277 |
1/2✓ Branch 0 taken 5291 times.
✗ Branch 1 not taken.
|
5291 | if(!p_igetl(&temp_trigger.req_level_state, f)) |
| 18278 | ✗ | return qe_invalid; | |
| 18279 |
1/2✓ Branch 0 taken 5291 times.
✗ Branch 1 not taken.
|
5291 | if(!p_igetl(&temp_trigger.unreq_level_state, f)) |
| 18280 | ✗ | return qe_invalid; | |
| 18281 |
1/2✓ Branch 0 taken 5291 times.
✗ Branch 1 not taken.
|
5291 | if(!p_getbitstr(&temp_trigger.req_global_state, f)) |
| 18282 | ✗ | return qe_invalid; | |
| 18283 |
1/2✓ Branch 0 taken 5291 times.
✗ Branch 1 not taken.
|
5291 | if(!p_getbitstr(&temp_trigger.unreq_global_state, f)) |
| 18284 | ✗ | return qe_invalid; | |
| 18285 |
1/2✓ Branch 0 taken 5291 times.
✗ Branch 1 not taken.
|
5291 | if(!p_igetw(&temp_trigger.fail_prompt_cid,f)) |
| 18286 | ✗ | return qe_invalid; | |
| 18287 |
1/2✓ Branch 0 taken 5291 times.
✗ Branch 1 not taken.
|
5291 | if(!p_getc(&temp_trigger.fail_prompt_cs,f)) |
| 18288 | ✗ | return qe_invalid; | |
| 18289 |
1/2✓ Branch 0 taken 5291 times.
✗ Branch 1 not taken.
|
5291 | if(!p_igetl(&temp_trigger.trig_msgstr, f)) |
| 18290 | ✗ | return qe_invalid; | |
| 18291 |
1/2✓ Branch 0 taken 5291 times.
✗ Branch 1 not taken.
|
5291 | if(!p_igetl(&temp_trigger.fail_msgstr, f)) |
| 18292 | ✗ | return qe_invalid; | |
| 18293 |
1/2✓ Branch 0 taken 5291 times.
✗ Branch 1 not taken.
|
5291 | if(!p_igetzf(&temp_trigger.player_bounce, f)) |
| 18294 | ✗ | return qe_invalid; | |
| 18295 |
1/2✓ Branch 0 taken 5291 times.
✗ Branch 1 not taken.
|
5291 | if(!p_igetzf(&temp_trigger.req_player_z, f)) |
| 18296 | ✗ | return qe_invalid; | |
| 18297 | 5291 | } | |
| 18298 | else | ||
| 18299 | { | ||
| 18300 | 7621 | temp_trigger.fail_prompt_cid = temp_trigger.prompt_cid; | |
| 18301 | 7621 | temp_trigger.fail_prompt_cs = temp_trigger.prompt_cs; | |
| 18302 | } | ||
| 18303 |
2/2✓ Branch 0 taken 7867 times.
✓ Branch 1 taken 5045 times.
|
12912 | if(s_version >= 54) |
| 18304 | { | ||
| 18305 |
1/2✓ Branch 0 taken 5045 times.
✗ Branch 1 not taken.
|
5045 | if(!p_getc(&temp_trigger.req_player_dir,f)) |
| 18306 | ✗ | return qe_invalid; | |
| 18307 |
1/2✓ Branch 0 taken 5045 times.
✗ Branch 1 not taken.
|
5045 | if(!p_igetzf(&temp_trigger.dest_player_x, f)) |
| 18308 | ✗ | return qe_invalid; | |
| 18309 |
1/2✓ Branch 0 taken 5045 times.
✗ Branch 1 not taken.
|
5045 | if(!p_igetzf(&temp_trigger.dest_player_y, f)) |
| 18310 | ✗ | return qe_invalid; | |
| 18311 |
1/2✓ Branch 0 taken 5045 times.
✗ Branch 1 not taken.
|
5045 | if(!p_igetzf(&temp_trigger.dest_player_z, f)) |
| 18312 | ✗ | return qe_invalid; | |
| 18313 |
1/2✓ Branch 0 taken 5045 times.
✗ Branch 1 not taken.
|
5045 | if(!p_igetzf(&temp_trigger.req_player_jump, f)) |
| 18314 | ✗ | return qe_invalid; | |
| 18315 |
1/2✓ Branch 0 taken 5045 times.
✗ Branch 1 not taken.
|
5045 | if(!p_igetzf(&temp_trigger.req_player_x, f)) |
| 18316 | ✗ | return qe_invalid; | |
| 18317 |
1/2✓ Branch 0 taken 5045 times.
✗ Branch 1 not taken.
|
5045 | if(!p_igetzf(&temp_trigger.req_player_y, f)) |
| 18318 | ✗ | return qe_invalid; | |
| 18319 | 5045 | } | |
| 18320 |
2/2✓ Branch 0 taken 7867 times.
✓ Branch 1 taken 5045 times.
|
12912 | if(s_version >= 56) |
| 18321 | { | ||
| 18322 |
1/2✓ Branch 0 taken 5045 times.
✗ Branch 1 not taken.
|
5045 | if(!p_getc(&temp_trigger.dest_player_dir, f)) |
| 18323 | ✗ | return qe_invalid; | |
| 18324 |
1/2✓ Branch 0 taken 5045 times.
✗ Branch 1 not taken.
|
5045 | if(!p_igetl(&temp_trigger.force_ice_combo, f)) |
| 18325 | ✗ | return qe_invalid; | |
| 18326 |
1/2✓ Branch 0 taken 5045 times.
✗ Branch 1 not taken.
|
5045 | if(!p_igetzf(&temp_trigger.force_ice_vx, f)) |
| 18327 | ✗ | return qe_invalid; | |
| 18328 |
1/2✓ Branch 0 taken 5045 times.
✗ Branch 1 not taken.
|
5045 | if(!p_igetzf(&temp_trigger.force_ice_vy, f)) |
| 18329 | ✗ | return qe_invalid; | |
| 18330 | 5045 | } | |
| 18331 | 12912 | return 0; | |
| 18332 | 12912 | } | |
| 18333 | |||
| 18334 | 1490549 | int32_t readcombo_loop(PACKFILE* f, word s_version, newcombo& temp_combo) | |
| 18335 | { | ||
| 18336 | byte tempbyte; | ||
| 18337 | word combo_has_flags; | ||
| 18338 |
2/2✓ Branch 0 taken 659309 times.
✓ Branch 1 taken 831240 times.
|
1490549 | if(s_version < 55) |
| 18339 | { | ||
| 18340 |
1/2✓ Branch 0 taken 659309 times.
✗ Branch 1 not taken.
|
659309 | if(!p_getc(&tempbyte,f)) |
| 18341 | ✗ | return qe_invalid; | |
| 18342 | 659309 | combo_has_flags = tempbyte; | |
| 18343 | 659309 | } | |
| 18344 | else | ||
| 18345 | { | ||
| 18346 |
1/2✓ Branch 0 taken 831240 times.
✗ Branch 1 not taken.
|
831240 | if(!p_igetw(&combo_has_flags,f)) |
| 18347 | ✗ | return qe_invalid; | |
| 18348 | } | ||
| 18349 | |||
| 18350 | 1490549 | temp_combo.clear(); | |
| 18351 |
2/2✓ Branch 0 taken 309311 times.
✓ Branch 1 taken 1181238 times.
|
1490549 | if(combo_has_flags) |
| 18352 | { | ||
| 18353 |
2/2✓ Branch 0 taken 513864 times.
✓ Branch 1 taken 667374 times.
|
1181238 | if(combo_has_flags&CHAS_BASIC) |
| 18354 | { | ||
| 18355 |
1/2✓ Branch 0 taken 667374 times.
✗ Branch 1 not taken.
|
667374 | if(!p_igetl(&temp_combo.tile,f)) |
| 18356 | ✗ | return qe_invalid; | |
| 18357 | 667374 | temp_combo.o_tile = temp_combo.tile; | |
| 18358 | |||
| 18359 |
1/2✓ Branch 0 taken 667374 times.
✗ Branch 1 not taken.
|
667374 | if(!p_getc(&temp_combo.flip,f)) |
| 18360 | ✗ | return qe_invalid; | |
| 18361 | |||
| 18362 |
1/2✓ Branch 0 taken 667374 times.
✗ Branch 1 not taken.
|
667374 | if(!p_getc(&temp_combo.walk,f)) |
| 18363 | ✗ | return qe_invalid; | |
| 18364 | |||
| 18365 |
1/2✓ Branch 0 taken 667374 times.
✗ Branch 1 not taken.
|
667374 | if(!p_getc(&temp_combo.type,f)) |
| 18366 | ✗ | return qe_invalid; | |
| 18367 | |||
| 18368 |
1/2✓ Branch 0 taken 667374 times.
✗ Branch 1 not taken.
|
667374 | if(!p_getc(&temp_combo.flag,f)) |
| 18369 | ✗ | return qe_invalid; | |
| 18370 | |||
| 18371 |
1/2✓ Branch 0 taken 667374 times.
✗ Branch 1 not taken.
|
667374 | if(!p_getc(&temp_combo.csets,f)) |
| 18372 | ✗ | return qe_invalid; | |
| 18373 | 667374 | } | |
| 18374 |
2/2✓ Branch 0 taken 1178383 times.
✓ Branch 1 taken 2855 times.
|
1181238 | if(combo_has_flags&CHAS_SCRIPT) |
| 18375 | { | ||
| 18376 |
2/2✓ Branch 0 taken 2825 times.
✓ Branch 1 taken 30 times.
|
2855 | if (s_version>=41) |
| 18377 | { | ||
| 18378 | 2825 | p_getcstr(&temp_combo.label, f); | |
| 18379 | 2825 | } | |
| 18380 | else | ||
| 18381 | { | ||
| 18382 | char label[12]; | ||
| 18383 | 30 | label[11] = '\0'; | |
| 18384 |
2/2✓ Branch 0 taken 330 times.
✓ Branch 1 taken 30 times.
|
360 | for ( int32_t q = 0; q < 11; q++ ) |
| 18385 |
1/2✓ Branch 0 taken 330 times.
✗ Branch 1 not taken.
|
330 | if(!p_getc(&label[q],f)) |
| 18386 | ✗ | return qe_invalid; | |
| 18387 | 30 | temp_combo.label = label; | |
| 18388 | } | ||
| 18389 | |||
| 18390 |
1/2✓ Branch 0 taken 2855 times.
✗ Branch 1 not taken.
|
2855 | if(!p_igetw(&temp_combo.script,f)) return qe_invalid; |
| 18391 | 2855 | auto initd_count = s_version >= 43 ? 8 : 2; | |
| 18392 |
2/2✓ Branch 0 taken 22660 times.
✓ Branch 1 taken 2855 times.
|
25515 | for ( int32_t q = 0; q < initd_count; q++ ) |
| 18393 |
1/2✓ Branch 0 taken 22660 times.
✗ Branch 1 not taken.
|
22660 | if(!p_igetl(&temp_combo.initd[q],f)) |
| 18394 | ✗ | return qe_invalid; | |
| 18395 | 2855 | } | |
| 18396 |
2/2✓ Branch 0 taken 1054126 times.
✓ Branch 1 taken 127112 times.
|
1181238 | if(combo_has_flags&CHAS_ANIM) |
| 18397 | { | ||
| 18398 |
1/2✓ Branch 0 taken 127112 times.
✗ Branch 1 not taken.
|
127112 | if(!p_getc(&temp_combo.frames,f)) |
| 18399 | ✗ | return qe_invalid; | |
| 18400 | |||
| 18401 |
1/2✓ Branch 0 taken 127112 times.
✗ Branch 1 not taken.
|
127112 | if(!p_getc(&temp_combo.speed,f)) |
| 18402 | ✗ | return qe_invalid; | |
| 18403 | |||
| 18404 |
1/2✓ Branch 0 taken 127112 times.
✗ Branch 1 not taken.
|
127112 | if(!p_igetw(&temp_combo.nextcombo,f)) |
| 18405 | ✗ | return qe_invalid; | |
| 18406 | |||
| 18407 |
1/2✓ Branch 0 taken 127112 times.
✗ Branch 1 not taken.
|
127112 | if(!p_getc(&temp_combo.nextcset,f)) |
| 18408 | ✗ | return qe_invalid; | |
| 18409 | |||
| 18410 |
1/2✓ Branch 0 taken 127112 times.
✗ Branch 1 not taken.
|
127112 | if(!p_getc(&temp_combo.skipanim,f)) |
| 18411 | ✗ | return qe_invalid; | |
| 18412 | |||
| 18413 |
1/2✓ Branch 0 taken 127112 times.
✗ Branch 1 not taken.
|
127112 | if(!p_getc(&temp_combo.skipanimy,f)) |
| 18414 | ✗ | return qe_invalid; | |
| 18415 | |||
| 18416 |
1/2✓ Branch 0 taken 127112 times.
✗ Branch 1 not taken.
|
127112 | if(!p_getc(&temp_combo.animflags,f)) |
| 18417 | ✗ | return qe_invalid; | |
| 18418 | 127112 | } | |
| 18419 |
2/2✓ Branch 0 taken 1123858 times.
✓ Branch 1 taken 57380 times.
|
1181238 | if(combo_has_flags&CHAS_ATTRIB) |
| 18420 | { | ||
| 18421 |
2/2✓ Branch 0 taken 229520 times.
✓ Branch 1 taken 57380 times.
|
286900 | for ( int32_t q = 0; q < 4; q++ ) |
| 18422 |
1/2✓ Branch 0 taken 229520 times.
✗ Branch 1 not taken.
|
229520 | if(!p_igetl(&temp_combo.attributes[q],f)) |
| 18423 | ✗ | return qe_invalid; | |
| 18424 |
2/2✓ Branch 0 taken 459040 times.
✓ Branch 1 taken 57380 times.
|
516420 | for ( int32_t q = 0; q < 8; q++ ) |
| 18425 |
1/2✓ Branch 0 taken 459040 times.
✗ Branch 1 not taken.
|
459040 | if(!p_getc(&temp_combo.attribytes[q],f)) |
| 18426 | ✗ | return qe_invalid; | |
| 18427 |
2/2✓ Branch 0 taken 459040 times.
✓ Branch 1 taken 57380 times.
|
516420 | for ( int32_t q = 0; q < 8; q++ ) |
| 18428 |
1/2✓ Branch 0 taken 459040 times.
✗ Branch 1 not taken.
|
459040 | if(!p_igetw(&temp_combo.attrishorts[q],f)) |
| 18429 | ✗ | return qe_invalid; | |
| 18430 | 57380 | } | |
| 18431 |
2/2✓ Branch 0 taken 1168841 times.
✓ Branch 1 taken 12397 times.
|
1181238 | if(combo_has_flags&CHAS_FLAG) |
| 18432 | { | ||
| 18433 |
1/2✓ Branch 0 taken 12397 times.
✗ Branch 1 not taken.
|
12397 | if(!p_igetl(&temp_combo.usrflags,f)) |
| 18434 | ✗ | return qe_invalid; | |
| 18435 |
1/2✓ Branch 0 taken 12397 times.
✗ Branch 1 not taken.
|
12397 | if(!p_igetw(&temp_combo.genflags,f)) |
| 18436 | ✗ | return qe_invalid; | |
| 18437 | 12397 | } | |
| 18438 |
2/2✓ Branch 0 taken 1168403 times.
✓ Branch 1 taken 12835 times.
|
1181238 | if(combo_has_flags&CHAS_TRIG) |
| 18439 | { | ||
| 18440 | 12835 | byte count = 1; | |
| 18441 |
2/2✓ Branch 0 taken 7621 times.
✓ Branch 1 taken 5214 times.
|
12835 | if(s_version >= 52) |
| 18442 |
1/2✓ Branch 0 taken 5214 times.
✗ Branch 1 not taken.
|
5214 | if(!p_getc(&count, f)) |
| 18443 | ✗ | return qe_invalid; | |
| 18444 | |||
| 18445 |
2/2✓ Branch 0 taken 12912 times.
✓ Branch 1 taken 12835 times.
|
25747 | for(byte q = 0; q < count; ++q) |
| 18446 | { | ||
| 18447 | 12912 | combo_trigger& temp_trigger = temp_combo.triggers.emplace_back(); | |
| 18448 | 12912 | auto ret = readcombo_triggers_loop(f, s_version, temp_trigger); | |
| 18449 |
1/2✓ Branch 0 taken 12912 times.
✗ Branch 1 not taken.
|
12912 | if(ret) |
| 18450 | ✗ | return ret; | |
| 18451 | 12912 | } | |
| 18452 | |||
| 18453 |
2/2✓ Branch 0 taken 7621 times.
✓ Branch 1 taken 5214 times.
|
12835 | if(s_version < 52) |
| 18454 | { | ||
| 18455 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 7621 times.
|
7621 | if(!temp_combo.triggers.empty()) |
| 18456 | 7621 | temp_combo.only_gentrig = (temp_combo.triggers[0].trigger_flags.get(TRIGFLAG_ONLYGENTRIG)) ? 1 : 0; | |
| 18457 | 7621 | } | |
| 18458 |
1/2✓ Branch 0 taken 5214 times.
✗ Branch 1 not taken.
|
5214 | else if(!p_getc(&temp_combo.only_gentrig,f)) |
| 18459 | ✗ | return qe_invalid; | |
| 18460 | 12835 | } | |
| 18461 |
2/2✓ Branch 0 taken 349853 times.
✓ Branch 1 taken 831385 times.
|
1181238 | if(combo_has_flags&CHAS_LIFT) |
| 18462 | { | ||
| 18463 |
1/2✓ Branch 0 taken 831385 times.
✗ Branch 1 not taken.
|
831385 | if(!p_igetw(&temp_combo.liftcmb,f)) |
| 18464 | ✗ | return qe_invalid; | |
| 18465 |
1/2✓ Branch 0 taken 831385 times.
✗ Branch 1 not taken.
|
831385 | if(!p_getc(&temp_combo.liftcs,f)) |
| 18466 | ✗ | return qe_invalid; | |
| 18467 |
1/2✓ Branch 0 taken 831385 times.
✗ Branch 1 not taken.
|
831385 | if(!p_igetw(&temp_combo.liftundercmb,f)) |
| 18468 | ✗ | return qe_invalid; | |
| 18469 |
1/2✓ Branch 0 taken 831385 times.
✗ Branch 1 not taken.
|
831385 | if(!p_getc(&temp_combo.liftundercs,f)) |
| 18470 | ✗ | return qe_invalid; | |
| 18471 |
1/2✓ Branch 0 taken 831385 times.
✗ Branch 1 not taken.
|
831385 | if(!p_getc(&temp_combo.liftdmg,f)) |
| 18472 | ✗ | return qe_invalid; | |
| 18473 |
1/2✓ Branch 0 taken 831385 times.
✗ Branch 1 not taken.
|
831385 | if(!p_getc(&temp_combo.liftlvl,f)) |
| 18474 | ✗ | return qe_invalid; | |
| 18475 |
1/2✓ Branch 0 taken 831385 times.
✗ Branch 1 not taken.
|
831385 | if(!p_getc(&temp_combo.liftitm,f)) |
| 18476 | ✗ | return qe_invalid; | |
| 18477 |
1/2✓ Branch 0 taken 831385 times.
✗ Branch 1 not taken.
|
831385 | if(!p_getc(&temp_combo.liftflags,f)) |
| 18478 | ✗ | return qe_invalid; | |
| 18479 |
1/2✓ Branch 0 taken 831385 times.
✗ Branch 1 not taken.
|
831385 | if(!p_getc(&temp_combo.liftgfx,f)) |
| 18480 | ✗ | return qe_invalid; | |
| 18481 |
1/2✓ Branch 0 taken 831385 times.
✗ Branch 1 not taken.
|
831385 | if(!p_getc(&temp_combo.liftsprite,f)) |
| 18482 | ✗ | return qe_invalid; | |
| 18483 |
1/2✓ Branch 0 taken 831385 times.
✗ Branch 1 not taken.
|
831385 | if(!p_getc(&temp_combo.liftsfx,f)) |
| 18484 | ✗ | return qe_invalid; | |
| 18485 |
1/2✓ Branch 0 taken 831385 times.
✗ Branch 1 not taken.
|
831385 | if(!p_igetw(&temp_combo.liftbreaksprite,f)) |
| 18486 | ✗ | return qe_invalid; | |
| 18487 |
1/2✓ Branch 0 taken 831385 times.
✗ Branch 1 not taken.
|
831385 | if(!p_getc(&temp_combo.liftbreaksfx,f)) |
| 18488 | ✗ | return qe_invalid; | |
| 18489 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 831385 times.
|
831385 | if(s_version >= 34) |
| 18490 | { | ||
| 18491 |
1/2✓ Branch 0 taken 831385 times.
✗ Branch 1 not taken.
|
831385 | if(!p_getc(&temp_combo.lifthei,f)) |
| 18492 | ✗ | return qe_invalid; | |
| 18493 |
1/2✓ Branch 0 taken 831385 times.
✗ Branch 1 not taken.
|
831385 | if(!p_getc(&temp_combo.lifttime,f)) |
| 18494 | ✗ | return qe_invalid; | |
| 18495 | 831385 | } | |
| 18496 |
2/2✓ Branch 0 taken 14 times.
✓ Branch 1 taken 831371 times.
|
831385 | if(s_version >= 39) |
| 18497 | { | ||
| 18498 |
1/2✓ Branch 0 taken 831371 times.
✗ Branch 1 not taken.
|
831371 | if(!p_getc(&temp_combo.lift_parent_item,f)) |
| 18499 | ✗ | return qe_invalid; | |
| 18500 | 831371 | } | |
| 18501 | 831385 | auto& weap_data = temp_combo.lift_weap_data; | |
| 18502 |
4/4✓ Branch 0 taken 831268 times.
✓ Branch 1 taken 117 times.
✓ Branch 2 taken 831240 times.
✓ Branch 3 taken 28 times.
|
831385 | if(s_version >= 51 && s_version < 55) |
| 18503 | { | ||
| 18504 |
1/2✓ Branch 0 taken 28 times.
✗ Branch 1 not taken.
|
28 | if(!p_getc(&weap_data.light_rads[WPNSPR_BASE],f)) |
| 18505 | ✗ | return qe_invalid; | |
| 18506 |
1/2✓ Branch 0 taken 28 times.
✗ Branch 1 not taken.
|
28 | if(!p_getc(&weap_data.glow_shape,f)) |
| 18507 | ✗ | return qe_invalid; | |
| 18508 | 28 | } | |
| 18509 | |||
| 18510 |
2/2✓ Branch 0 taken 831240 times.
✓ Branch 1 taken 145 times.
|
831385 | if(s_version >= 55) |
| 18511 | { | ||
| 18512 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 831240 times.
|
831240 | if(auto ret = read_weap_data(weap_data, f)) |
| 18513 | ✗ | return ret; | |
| 18514 | 831240 | } | |
| 18515 | else | ||
| 18516 | { | ||
| 18517 | 145 | auto const& pitm = itemsbuf[temp_combo.lift_parent_item]; | |
| 18518 | 145 | auto weap_glow = weap_data.light_rads[WPNSPR_BASE]; | |
| 18519 |
2/2✓ Branch 0 taken 6 times.
✓ Branch 1 taken 139 times.
|
145 | switch(pitm.family) |
| 18520 | { | ||
| 18521 | case itype_bomb: | ||
| 18522 | case itype_sbomb: | ||
| 18523 | 6 | weap_data = pitm.weap_data; | |
| 18524 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 6 times.
|
6 | if(!(weap_data.wflags & WFLAG_UPDATE_IGNITE_SPRITE)) |
| 18525 | { | ||
| 18526 | 6 | weap_data.flags |= wdata_glow_rad; | |
| 18527 | 6 | weap_data.light_rads[WPNSPR_BASE] = weap_glow; | |
| 18528 | 6 | } | |
| 18529 | 6 | break; | |
| 18530 | default: | ||
| 18531 | 139 | weap_data.wflags |= WFLAG_BREAK_WHEN_LANDING; | |
| 18532 | 139 | weap_data.flags |= wdata_glow_rad; | |
| 18533 | 139 | } | |
| 18534 | 145 | weap_data.moveflags |= move_obeys_grav|move_can_pitfall; | |
| 18535 |
2/2✓ Branch 0 taken 64 times.
✓ Branch 1 taken 81 times.
|
145 | if(temp_combo.liftflags & LF_BREAKONSOLID) |
| 18536 | 64 | weap_data.wflags |= WFLAG_BREAK_ON_SOLID; | |
| 18537 | } | ||
| 18538 | 831385 | } | |
| 18539 | |||
| 18540 |
2/2✓ Branch 0 taken 1147329 times.
✓ Branch 1 taken 33909 times.
|
1181238 | if(combo_has_flags&CHAS_GENERAL) |
| 18541 | { | ||
| 18542 |
1/2✓ Branch 0 taken 33909 times.
✗ Branch 1 not taken.
|
33909 | if(!p_getc(&temp_combo.speed_mult,f)) |
| 18543 | ✗ | return qe_invalid; | |
| 18544 |
1/2✓ Branch 0 taken 33909 times.
✗ Branch 1 not taken.
|
33909 | if(!p_getc(&temp_combo.speed_div,f)) |
| 18545 | ✗ | return qe_invalid; | |
| 18546 |
1/2✓ Branch 0 taken 33909 times.
✗ Branch 1 not taken.
|
33909 | if(!p_igetzf(&temp_combo.speed_add,f)) |
| 18547 | ✗ | return qe_invalid; | |
| 18548 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 33909 times.
|
33909 | if(s_version >= 42) |
| 18549 | { | ||
| 18550 |
1/2✓ Branch 0 taken 33909 times.
✗ Branch 1 not taken.
|
33909 | if(!p_getc(&temp_combo.sfx_appear,f)) |
| 18551 | ✗ | return qe_invalid; | |
| 18552 |
1/2✓ Branch 0 taken 33909 times.
✗ Branch 1 not taken.
|
33909 | if(!p_getc(&temp_combo.sfx_disappear,f)) |
| 18553 | ✗ | return qe_invalid; | |
| 18554 |
1/2✓ Branch 0 taken 33909 times.
✗ Branch 1 not taken.
|
33909 | if(!p_getc(&temp_combo.sfx_loop,f)) |
| 18555 | ✗ | return qe_invalid; | |
| 18556 |
1/2✓ Branch 0 taken 33909 times.
✗ Branch 1 not taken.
|
33909 | if(!p_getc(&temp_combo.sfx_walking,f)) |
| 18557 | ✗ | return qe_invalid; | |
| 18558 |
1/2✓ Branch 0 taken 33909 times.
✗ Branch 1 not taken.
|
33909 | if(!p_getc(&temp_combo.sfx_standing,f)) |
| 18559 | ✗ | return qe_invalid; | |
| 18560 |
1/2✓ Branch 0 taken 33909 times.
✗ Branch 1 not taken.
|
33909 | if(!p_getc(&temp_combo.spr_appear,f)) |
| 18561 | ✗ | return qe_invalid; | |
| 18562 |
1/2✓ Branch 0 taken 33909 times.
✗ Branch 1 not taken.
|
33909 | if(!p_getc(&temp_combo.spr_disappear,f)) |
| 18563 | ✗ | return qe_invalid; | |
| 18564 |
1/2✓ Branch 0 taken 33909 times.
✗ Branch 1 not taken.
|
33909 | if(!p_getc(&temp_combo.spr_walking,f)) |
| 18565 | ✗ | return qe_invalid; | |
| 18566 |
1/2✓ Branch 0 taken 33909 times.
✗ Branch 1 not taken.
|
33909 | if(!p_getc(&temp_combo.spr_standing,f)) |
| 18567 | ✗ | return qe_invalid; | |
| 18568 | 33909 | } | |
| 18569 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 33909 times.
|
33909 | if(s_version >= 44) |
| 18570 | { | ||
| 18571 |
1/2✓ Branch 0 taken 33909 times.
✗ Branch 1 not taken.
|
33909 | if(!p_getc(&temp_combo.sfx_tap,f)) |
| 18572 | ✗ | return qe_invalid; | |
| 18573 | 33909 | } | |
| 18574 |
2/2✓ Branch 0 taken 366 times.
✓ Branch 1 taken 33543 times.
|
33909 | if(s_version >= 49) |
| 18575 | { | ||
| 18576 |
1/2✓ Branch 0 taken 33543 times.
✗ Branch 1 not taken.
|
33543 | if(!p_getc(&temp_combo.sfx_landing,f)) |
| 18577 | ✗ | return qe_invalid; | |
| 18578 | 33543 | } | |
| 18579 |
2/2✓ Branch 0 taken 366 times.
✓ Branch 1 taken 33543 times.
|
33909 | if(s_version >= 50) |
| 18580 | { | ||
| 18581 |
1/2✓ Branch 0 taken 33543 times.
✗ Branch 1 not taken.
|
33543 | if(!p_getc(&temp_combo.spr_falling,f)) |
| 18582 | ✗ | return qe_invalid; | |
| 18583 |
1/2✓ Branch 0 taken 33543 times.
✗ Branch 1 not taken.
|
33543 | if(!p_getc(&temp_combo.spr_drowning,f)) |
| 18584 | ✗ | return qe_invalid; | |
| 18585 |
1/2✓ Branch 0 taken 33543 times.
✗ Branch 1 not taken.
|
33543 | if(!p_getc(&temp_combo.spr_lava_drowning,f)) |
| 18586 | ✗ | return qe_invalid; | |
| 18587 |
1/2✓ Branch 0 taken 33543 times.
✗ Branch 1 not taken.
|
33543 | if(!p_getc(&temp_combo.sfx_falling,f)) |
| 18588 | ✗ | return qe_invalid; | |
| 18589 |
1/2✓ Branch 0 taken 33543 times.
✗ Branch 1 not taken.
|
33543 | if(!p_getc(&temp_combo.sfx_drowning,f)) |
| 18590 | ✗ | return qe_invalid; | |
| 18591 |
1/2✓ Branch 0 taken 33543 times.
✗ Branch 1 not taken.
|
33543 | if(!p_getc(&temp_combo.sfx_lava_drowning,f)) |
| 18592 | ✗ | return qe_invalid; | |
| 18593 | 33543 | } | |
| 18594 |
2/2✓ Branch 0 taken 4953 times.
✓ Branch 1 taken 28956 times.
|
33909 | if(s_version >= 56) |
| 18595 | { | ||
| 18596 |
1/2✓ Branch 0 taken 28956 times.
✗ Branch 1 not taken.
|
28956 | if(!p_igetzf(&temp_combo.z_height,f)) |
| 18597 | ✗ | return qe_invalid; | |
| 18598 |
1/2✓ Branch 0 taken 28956 times.
✗ Branch 1 not taken.
|
28956 | if(!p_igetzf(&temp_combo.z_step_height,f)) |
| 18599 | ✗ | return qe_invalid; | |
| 18600 | 28956 | } | |
| 18601 | 33909 | } | |
| 18602 |
1/2✓ Branch 0 taken 1181238 times.
✗ Branch 1 not taken.
|
1181238 | if(combo_has_flags&CHAS_MISC_WEAP_DATA) |
| 18603 | { | ||
| 18604 | ✗ | if(auto ret = read_weap_data(temp_combo.misc_weap_data, f)) | |
| 18605 | ✗ | return ret; | |
| 18606 | ✗ | } | |
| 18607 | 1181238 | } | |
| 18608 | 1490549 | update_combo(temp_combo, s_version); | |
| 18609 | 1490549 | return 0; | |
| 18610 | 1490549 | } | |
| 18611 | |||
| 18612 | 479 | int32_t readcombos(PACKFILE *f, zquestheader *Header, word version, word build, word start_combo, word max_combos) | |
| 18613 | { | ||
| 18614 |
2/2✓ Branch 0 taken 455 times.
✓ Branch 1 taken 24 times.
|
479 | bool should_skip = legacy_skip_flags && get_bit(legacy_skip_flags, skip_combos); |
| 18615 | |||
| 18616 | 479 | word section_version=0; | |
| 18617 | 479 | word combos_used=0; | |
| 18618 | int32_t dummy; | ||
| 18619 | byte padding; | ||
| 18620 | 479 | newcombo temp_combo; | |
| 18621 | |||
| 18622 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 478 times.
|
479 | if (!should_skip) |
| 18623 | { | ||
| 18624 |
1/2✓ Branch 0 taken 478 times.
✗ Branch 1 not taken.
|
478 | reset_all_combo_animations(); |
| 18625 |
1/2✓ Branch 0 taken 478 times.
✗ Branch 1 not taken.
|
478 | init_combo_classes(); |
| 18626 | |||
| 18627 |
2/2✓ Branch 0 taken 31203840 times.
✓ Branch 1 taken 478 times.
|
31204318 | for(int32_t q = start_combo; q < start_combo+max_combos; ++q) |
| 18628 |
1/2✓ Branch 0 taken 31203840 times.
✗ Branch 1 not taken.
|
31203840 | combobuf[q].clear(); |
| 18629 | 478 | } | |
| 18630 | |||
| 18631 |
2/2✓ Branch 0 taken 455 times.
✓ Branch 1 taken 24 times.
|
479 | if(version > 0x192) //Version info |
| 18632 | { | ||
| 18633 |
2/4✓ Branch 0 taken 455 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 455 times.
✗ Branch 3 not taken.
|
455 | if(!p_igetw(§ion_version,f)) |
| 18634 | { | ||
| 18635 | ✗ | return qe_invalid; | |
| 18636 | } | ||
| 18637 | 455 | FFCore.quest_format[vCombos] = section_version; | |
| 18638 |
2/4✓ Branch 0 taken 455 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 455 times.
✗ Branch 3 not taken.
|
455 | if(!read_deprecated_section_cversion(f)) |
| 18639 | { | ||
| 18640 | ✗ | return qe_invalid; | |
| 18641 | } | ||
| 18642 | |||
| 18643 | //section size | ||
| 18644 |
2/4✓ Branch 0 taken 455 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 455 times.
✗ Branch 3 not taken.
|
455 | if(!p_igetl(&dummy,f)) |
| 18645 | { | ||
| 18646 | ✗ | return qe_invalid; | |
| 18647 | } | ||
| 18648 | 455 | } | |
| 18649 | |||
| 18650 |
2/2✓ Branch 0 taken 192 times.
✓ Branch 1 taken 287 times.
|
479 | if(section_version > 32) //Cleanup time! |
| 18651 | { | ||
| 18652 |
2/4✓ Branch 0 taken 192 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 192 times.
✗ Branch 3 not taken.
|
192 | if(!p_igetw(&combos_used,f)) |
| 18653 | { | ||
| 18654 | ✗ | return qe_invalid; | |
| 18655 | } | ||
| 18656 |
2/2✓ Branch 0 taken 1490549 times.
✓ Branch 1 taken 192 times.
|
1490741 | for(int32_t i=0; i<combos_used; i++) |
| 18657 | { | ||
| 18658 |
1/2✓ Branch 0 taken 1490549 times.
✗ Branch 1 not taken.
|
1490549 | auto ret = readcombo_loop(f,section_version,temp_combo); |
| 18659 |
1/2✓ Branch 0 taken 1490549 times.
✗ Branch 1 not taken.
|
1490549 | if(ret) return ret; |
| 18660 |
1/2✓ Branch 0 taken 1490549 times.
✗ Branch 1 not taken.
|
1490549 | if(i>=start_combo) |
| 18661 | { | ||
| 18662 |
1/2✓ Branch 0 taken 1490549 times.
✗ Branch 1 not taken.
|
1490549 | if(loading_tileset_flags & TILESET_CLEARSCRIPTS) |
| 18663 | { | ||
| 18664 | ✗ | temp_combo.script = 0; | |
| 18665 | ✗ | for(int q = 0; q < 8; ++q) | |
| 18666 | ✗ | temp_combo.initd[q] = 0; | |
| 18667 | ✗ | } | |
| 18668 |
1/2✓ Branch 0 taken 1490549 times.
✗ Branch 1 not taken.
|
1490549 | combobuf[i] = temp_combo; |
| 18669 | 1490549 | } | |
| 18670 | 1490549 | } | |
| 18671 | 192 | } | |
| 18672 | else //Call the old function for all old versions | ||
| 18673 | { | ||
| 18674 |
1/2✓ Branch 0 taken 287 times.
✗ Branch 1 not taken.
|
287 | auto ret = readcombos_old(section_version,f,Header,version,build,start_combo,max_combos); |
| 18675 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 287 times.
|
287 | if(ret) return ret; //error, end read |
| 18676 | } | ||
| 18677 | |||
| 18678 |
2/2✓ Branch 0 taken 478 times.
✓ Branch 1 taken 1 times.
|
479 | if (should_skip) |
| 18679 | 1 | return 0; | |
| 18680 | |||
| 18681 |
2/2✓ Branch 0 taken 296 times.
✓ Branch 1 taken 182 times.
|
478 | if(!get_qr(qr_ALLOW_EDITING_COMBO_0)) |
| 18682 | { | ||
| 18683 | 182 | combobuf[0].walk = 0xF0; | |
| 18684 | 182 | combobuf[0].type = 0; | |
| 18685 | 182 | combobuf[0].flag = 0; | |
| 18686 | 182 | } | |
| 18687 | |||
| 18688 |
1/2✓ Branch 0 taken 478 times.
✗ Branch 1 not taken.
|
478 | setup_combo_animations(); |
| 18689 |
1/2✓ Branch 0 taken 478 times.
✗ Branch 1 not taken.
|
478 | setup_combo_animations2(); |
| 18690 | 478 | return 0; | |
| 18691 | 479 | } | |
| 18692 | |||
| 18693 | 396 | int32_t readcomboaliases(PACKFILE *f, zquestheader *Header, word version, word build) | |
| 18694 | { | ||
| 18695 | //these are here to bypass compiler warnings about unused arguments | ||
| 18696 | 396 | Header=Header; | |
| 18697 | 396 | version=version; | |
| 18698 | 396 | build=build; | |
| 18699 | |||
| 18700 | int32_t dummy; | ||
| 18701 | 396 | word sversion=0, c_sversion; | |
| 18702 | |||
| 18703 | //section version info | ||
| 18704 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 396 times.
|
396 | if(!p_igetw(&sversion,f)) |
| 18705 | { | ||
| 18706 | ✗ | return qe_invalid; | |
| 18707 | } | ||
| 18708 | |||
| 18709 | 396 | FFCore.quest_format[vComboAliases] = sversion; | |
| 18710 | |||
| 18711 |
1/2✓ Branch 0 taken 396 times.
✗ Branch 1 not taken.
|
396 | if(!p_igetw(&c_sversion,f)) |
| 18712 | { | ||
| 18713 | ✗ | return qe_invalid; | |
| 18714 | } | ||
| 18715 | |||
| 18716 | //section size | ||
| 18717 |
1/2✓ Branch 0 taken 396 times.
✗ Branch 1 not taken.
|
396 | if(!p_igetl(&dummy,f)) |
| 18718 | { | ||
| 18719 | ✗ | return qe_invalid; | |
| 18720 | } | ||
| 18721 | |||
| 18722 | 396 | int32_t max_num_combo_aliases = MAXCOMBOALIASES; | |
| 18723 | |||
| 18724 |
2/2✓ Branch 0 taken 196 times.
✓ Branch 1 taken 200 times.
|
396 | if(sversion < 3) // max saved combo alias' upped from 256 to 2048. |
| 18725 | { | ||
| 18726 | 200 | max_num_combo_aliases = MAX250COMBOALIASES; | |
| 18727 | 200 | } | |
| 18728 |
1/2✓ Branch 0 taken 396 times.
✗ Branch 1 not taken.
|
396 | if(sversion < 2) // max saved combo alias' upped from 256 to 2048. |
| 18729 | { | ||
| 18730 | ✗ | max_num_combo_aliases = OLDMAXCOMBOALIASES; | |
| 18731 | ✗ | } | |
| 18732 | |||
| 18733 |
2/2✓ Branch 0 taken 2015232 times.
✓ Branch 1 taken 396 times.
|
2015628 | for(int32_t j=0; j<max_num_combo_aliases; j++) |
| 18734 | { | ||
| 18735 | byte width,height,mask,tempcset; | ||
| 18736 | int32_t count; | ||
| 18737 | word tempword; | ||
| 18738 | byte tempbyte; | ||
| 18739 | |||
| 18740 |
1/2✓ Branch 0 taken 2015232 times.
✗ Branch 1 not taken.
|
2015232 | if(!p_igetw(&tempword,f)) |
| 18741 | { | ||
| 18742 | ✗ | return qe_invalid; | |
| 18743 | } | ||
| 18744 | |||
| 18745 | 2015232 | combo_aliases[j].combo = tempword; | |
| 18746 | |||
| 18747 |
1/2✓ Branch 0 taken 2015232 times.
✗ Branch 1 not taken.
|
2015232 | if(!p_getc(&tempbyte,f)) |
| 18748 | { | ||
| 18749 | ✗ | return qe_invalid; | |
| 18750 | } | ||
| 18751 | |||
| 18752 | 2015232 | combo_aliases[j].cset = tempbyte; | |
| 18753 | |||
| 18754 |
1/2✓ Branch 0 taken 2015232 times.
✗ Branch 1 not taken.
|
2015232 | if(!p_getc(&width,f)) |
| 18755 | { | ||
| 18756 | ✗ | return qe_invalid; | |
| 18757 | } | ||
| 18758 | |||
| 18759 |
1/2✓ Branch 0 taken 2015232 times.
✗ Branch 1 not taken.
|
2015232 | if(!p_getc(&height,f)) |
| 18760 | { | ||
| 18761 | ✗ | return qe_invalid; | |
| 18762 | } | ||
| 18763 | |||
| 18764 |
1/2✓ Branch 0 taken 2015232 times.
✗ Branch 1 not taken.
|
2015232 | if(!p_getc(&mask,f)) |
| 18765 | { | ||
| 18766 | ✗ | return qe_invalid; | |
| 18767 | } | ||
| 18768 | |||
| 18769 | 2015232 | count=(width+1)*(height+1)*(comboa_lmasktotal(mask)+1); | |
| 18770 | |||
| 18771 | 2015232 | combo_aliases[j].width = width; | |
| 18772 | 2015232 | combo_aliases[j].height = height; | |
| 18773 | 2015232 | combo_aliases[j].layermask = mask; | |
| 18774 | 2015232 | combo_aliases[j].combos.clear(); | |
| 18775 | 2015232 | combo_aliases[j].csets.clear(); | |
| 18776 | |||
| 18777 |
2/2✓ Branch 0 taken 2066213 times.
✓ Branch 1 taken 2015232 times.
|
4081445 | for(int32_t k=0; k<count; k++) |
| 18778 | { | ||
| 18779 |
1/2✓ Branch 0 taken 2066213 times.
✗ Branch 1 not taken.
|
2066213 | if(!p_igetw(&tempword,f)) |
| 18780 | { | ||
| 18781 | ✗ | return qe_invalid; | |
| 18782 | } | ||
| 18783 | |||
| 18784 | 2066213 | combo_aliases[j].combos[k] = tempword; | |
| 18785 | 2066213 | } | |
| 18786 | |||
| 18787 |
2/2✓ Branch 0 taken 2066213 times.
✓ Branch 1 taken 2015232 times.
|
4081445 | for(int32_t k=0; k<count; k++) |
| 18788 | { | ||
| 18789 |
1/2✓ Branch 0 taken 2066213 times.
✗ Branch 1 not taken.
|
2066213 | if(!p_getc(&tempcset,f)) |
| 18790 | { | ||
| 18791 | ✗ | return qe_invalid; | |
| 18792 | } | ||
| 18793 | |||
| 18794 | 2066213 | combo_aliases[j].csets[k] = tempcset; | |
| 18795 | 2066213 | } | |
| 18796 | 2015232 | } | |
| 18797 | |||
| 18798 | //Combo pools! | ||
| 18799 | 396 | word num_combo_pools = 0; | |
| 18800 |
2/2✓ Branch 0 taken 204 times.
✓ Branch 1 taken 192 times.
|
396 | if(sversion >= 4) |
| 18801 | { | ||
| 18802 |
1/2✓ Branch 0 taken 192 times.
✗ Branch 1 not taken.
|
192 | if(!p_igetw(&num_combo_pools,f)) |
| 18803 | { | ||
| 18804 | ✗ | return qe_invalid; | |
| 18805 | } | ||
| 18806 | 192 | } | |
| 18807 | |||
| 18808 |
2/2✓ Branch 0 taken 3244032 times.
✓ Branch 1 taken 396 times.
|
3244428 | for(combo_pool& pool : combo_pools) |
| 18809 | { | ||
| 18810 | 3244032 | pool.clear(); | |
| 18811 | } | ||
| 18812 | |||
| 18813 | 396 | combo_pool temp_cpool; | |
| 18814 |
2/2✓ Branch 0 taken 487 times.
✓ Branch 1 taken 396 times.
|
883 | for(word cp = 0; cp < num_combo_pools; ++cp) |
| 18815 | { | ||
| 18816 | 487 | int32_t num_combos_in_pool = 0; | |
| 18817 |
2/4✓ Branch 0 taken 487 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 487 times.
✗ Branch 3 not taken.
|
487 | if(!p_igetl(&num_combos_in_pool,f)) |
| 18818 | { | ||
| 18819 | ✗ | return qe_invalid; | |
| 18820 | } | ||
| 18821 |
2/2✓ Branch 0 taken 391 times.
✓ Branch 1 taken 96 times.
|
487 | if(num_combos_in_pool < 1) continue; //nothing to read |
| 18822 | |||
| 18823 |
1/2✓ Branch 0 taken 391 times.
✗ Branch 1 not taken.
|
391 | temp_cpool.clear(); |
| 18824 | |||
| 18825 | int32_t cp_cid; int8_t cp_cs; word cp_quant; | ||
| 18826 |
2/2✓ Branch 0 taken 391 times.
✓ Branch 1 taken 1762 times.
|
2153 | for(auto q = 0; q < num_combos_in_pool; ++q) |
| 18827 | { | ||
| 18828 |
2/4✓ Branch 0 taken 1762 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1762 times.
✗ Branch 3 not taken.
|
1762 | if(!p_igetl(&cp_cid,f)) |
| 18829 | { | ||
| 18830 | ✗ | return qe_invalid; | |
| 18831 | } | ||
| 18832 |
2/4✓ Branch 0 taken 1762 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1762 times.
✗ Branch 3 not taken.
|
1762 | if(!p_getc(&cp_cs,f)) |
| 18833 | { | ||
| 18834 | ✗ | return qe_invalid; | |
| 18835 | } | ||
| 18836 |
2/4✓ Branch 0 taken 1762 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1762 times.
✗ Branch 3 not taken.
|
1762 | if(!p_igetw(&cp_quant,f)) |
| 18837 | { | ||
| 18838 | ✗ | return qe_invalid; | |
| 18839 | } | ||
| 18840 |
1/2✓ Branch 0 taken 1762 times.
✗ Branch 1 not taken.
|
1762 | temp_cpool.add(cp_cid, cp_cs, cp_quant); |
| 18841 | 1762 | } | |
| 18842 | |||
| 18843 |
1/2✓ Branch 0 taken 391 times.
✗ Branch 1 not taken.
|
391 | combo_pools[cp] = temp_cpool; |
| 18844 | 391 | } | |
| 18845 | |||
| 18846 | //Autocombos! | ||
| 18847 | 396 | word num_combo_autos = 0; | |
| 18848 |
2/2✓ Branch 0 taken 180 times.
✓ Branch 1 taken 216 times.
|
396 | if (sversion >= 5) |
| 18849 | { | ||
| 18850 |
2/4✓ Branch 0 taken 180 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 180 times.
✗ Branch 3 not taken.
|
180 | if (!p_igetw(&num_combo_autos, f)) |
| 18851 | { | ||
| 18852 | ✗ | return qe_invalid; | |
| 18853 | } | ||
| 18854 | 180 | } | |
| 18855 | |||
| 18856 |
2/2✓ Branch 0 taken 396 times.
✓ Branch 1 taken 3244032 times.
|
3244428 | for (combo_auto& cauto : combo_autos) |
| 18857 | { | ||
| 18858 |
1/2✓ Branch 0 taken 3244032 times.
✗ Branch 1 not taken.
|
3244032 | cauto.clear(true); |
| 18859 | } | ||
| 18860 | |||
| 18861 |
1/2✓ Branch 0 taken 396 times.
✗ Branch 1 not taken.
|
396 | combo_auto temp_cauto; |
| 18862 |
2/2✓ Branch 0 taken 126 times.
✓ Branch 1 taken 396 times.
|
522 | for (word ca = 0; ca < num_combo_autos; ++ca) |
| 18863 | { | ||
| 18864 | byte type; | ||
| 18865 | int32_t display_cid, erase_cid; | ||
| 18866 | byte flags, arg; | ||
| 18867 |
2/4✓ Branch 0 taken 126 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 126 times.
✗ Branch 3 not taken.
|
126 | if (!p_getc(&type, f)) |
| 18868 | { | ||
| 18869 | ✗ | return qe_invalid; | |
| 18870 | } | ||
| 18871 |
2/4✓ Branch 0 taken 126 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 126 times.
✗ Branch 3 not taken.
|
126 | if (!p_igetl(&display_cid, f)) |
| 18872 | { | ||
| 18873 | ✗ | return qe_invalid; | |
| 18874 | } | ||
| 18875 |
2/4✓ Branch 0 taken 126 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 126 times.
✗ Branch 3 not taken.
|
126 | if (!p_igetl(&erase_cid, f)) |
| 18876 | { | ||
| 18877 | ✗ | return qe_invalid; | |
| 18878 | } | ||
| 18879 |
2/4✓ Branch 0 taken 126 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 126 times.
✗ Branch 3 not taken.
|
126 | if (!p_getc(&flags, f)) |
| 18880 | { | ||
| 18881 | ✗ | return qe_invalid; | |
| 18882 | } | ||
| 18883 |
2/4✓ Branch 0 taken 126 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 126 times.
✗ Branch 3 not taken.
|
126 | if (!p_getc(&arg, f)) |
| 18884 | { | ||
| 18885 | ✗ | return qe_invalid; | |
| 18886 | } | ||
| 18887 | 126 | int32_t num_combos_in_cauto = 0; | |
| 18888 |
2/4✓ Branch 0 taken 126 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 126 times.
✗ Branch 3 not taken.
|
126 | if (!p_igetl(&num_combos_in_cauto, f)) |
| 18889 | { | ||
| 18890 | ✗ | return qe_invalid; | |
| 18891 | } | ||
| 18892 |
2/2✓ Branch 0 taken 105 times.
✓ Branch 1 taken 21 times.
|
126 | if (num_combos_in_cauto < 1) continue; //nothing to read |
| 18893 | |||
| 18894 |
1/2✓ Branch 0 taken 105 times.
✗ Branch 1 not taken.
|
105 | temp_cauto.clear(); |
| 18895 | |||
| 18896 |
1/2✓ Branch 0 taken 105 times.
✗ Branch 1 not taken.
|
105 | temp_cauto.setType(type); |
| 18897 |
1/2✓ Branch 0 taken 105 times.
✗ Branch 1 not taken.
|
105 | temp_cauto.setDisplay(display_cid); |
| 18898 |
1/2✓ Branch 0 taken 105 times.
✗ Branch 1 not taken.
|
105 | temp_cauto.setEraseCombo(erase_cid); |
| 18899 |
1/2✓ Branch 0 taken 105 times.
✗ Branch 1 not taken.
|
105 | temp_cauto.setFlags(flags); |
| 18900 |
1/2✓ Branch 0 taken 105 times.
✗ Branch 1 not taken.
|
105 | temp_cauto.setArg(arg); |
| 18901 | |||
| 18902 | int32_t ca_cid; byte ca_ctype; int16_t ca_offset; int16_t ca_engrave_offset; | ||
| 18903 |
2/2✓ Branch 0 taken 105 times.
✓ Branch 1 taken 2361 times.
|
2466 | for (auto q = 0; q < num_combos_in_cauto; ++q) |
| 18904 | { | ||
| 18905 |
2/4✓ Branch 0 taken 2361 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2361 times.
✗ Branch 3 not taken.
|
2361 | if (!p_getc(&ca_ctype, f)) |
| 18906 | { | ||
| 18907 | ✗ | return qe_invalid; | |
| 18908 | } | ||
| 18909 |
2/4✓ Branch 0 taken 2361 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2361 times.
✗ Branch 3 not taken.
|
2361 | if (!p_igetl(&ca_cid, f)) |
| 18910 | { | ||
| 18911 | ✗ | return qe_invalid; | |
| 18912 | } | ||
| 18913 |
1/2✓ Branch 0 taken 2361 times.
✗ Branch 1 not taken.
|
2361 | temp_cauto.addEntry(ca_cid, ca_ctype, q, -1); |
| 18914 | 2361 | } | |
| 18915 | |||
| 18916 |
1/2✓ Branch 0 taken 105 times.
✗ Branch 1 not taken.
|
105 | combo_autos[ca] = temp_cauto; |
| 18917 | 105 | } | |
| 18918 | |||
| 18919 | 396 | return 0; | |
| 18920 | 396 | } | |
| 18921 | |||
| 18922 | 800 | int32_t readcolordata(PACKFILE *f, miscQdata *Misc, word version, word build, word start_cset, word max_csets) | |
| 18923 | { | ||
| 18924 |
2/2✓ Branch 0 taken 776 times.
✓ Branch 1 taken 24 times.
|
800 | bool should_skip = legacy_skip_flags && get_bit(legacy_skip_flags, skip_colors); |
| 18925 | |||
| 18926 | //these are here to bypass compiler warnings about unused arguments | ||
| 18927 | //THE *48 REFERS TO EACH CSET BEING 16 COLORS with 3 VALUES OF RGB (3*16 is 48) | ||
| 18928 | //Capitalized cause it'll save you a headache. -Deedee | ||
| 18929 | 800 | start_cset=start_cset; | |
| 18930 | 800 | max_csets=max_csets; | |
| 18931 | 800 | word s_version=0; | |
| 18932 | |||
| 18933 | miscQdata temp_misc; | ||
| 18934 | 800 | memcpy(&temp_misc, Misc, sizeof(temp_misc)); | |
| 18935 | |||
| 18936 | byte temp_colordata[48]; | ||
| 18937 | char temp_palname[PALNAMESIZE+1]; | ||
| 18938 | |||
| 18939 | int32_t dummy; | ||
| 18940 | word palcycles; | ||
| 18941 | |||
| 18942 |
2/2✓ Branch 0 taken 24 times.
✓ Branch 1 taken 776 times.
|
800 | if(version > 0x192) |
| 18943 | { | ||
| 18944 | //section version info | ||
| 18945 |
1/2✓ Branch 0 taken 776 times.
✗ Branch 1 not taken.
|
776 | if(!p_igetw(&s_version,f)) |
| 18946 | { | ||
| 18947 | ✗ | return qe_invalid; | |
| 18948 | } | ||
| 18949 | |||
| 18950 | 776 | FFCore.quest_format[vCSets] = s_version; | |
| 18951 | |||
| 18952 |
1/2✓ Branch 0 taken 776 times.
✗ Branch 1 not taken.
|
776 | if(!p_igetw(&dummy,f)) |
| 18953 | { | ||
| 18954 | ✗ | return qe_invalid; | |
| 18955 | } | ||
| 18956 | |||
| 18957 | //section size | ||
| 18958 |
1/2✓ Branch 0 taken 776 times.
✗ Branch 1 not taken.
|
776 | if(!p_igetl(&dummy,f)) |
| 18959 | { | ||
| 18960 | ✗ | return qe_invalid; | |
| 18961 | } | ||
| 18962 | 776 | } | |
| 18963 |
2/2✓ Branch 0 taken 604 times.
✓ Branch 1 taken 196 times.
|
800 | if (s_version < 5) |
| 18964 | { | ||
| 18965 |
4/4✓ Branch 0 taken 18 times.
✓ Branch 1 taken 586 times.
✓ Branch 2 taken 580 times.
✓ Branch 3 taken 6 times.
|
604 | bool RealOldVerion = ((version < 0x192)||((version == 0x192)&&(build<73))); |
| 18966 | |||
| 18967 | //finally... section data | ||
| 18968 | 604 | int32_t q = 0; | |
| 18969 | 604 | int32_t p = -15; | |
| 18970 |
2/2✓ Branch 0 taken 144960 times.
✓ Branch 1 taken 604 times.
|
145564 | for(int32_t i=0; i<oldpdTOTAL; ++i) |
| 18971 | { | ||
| 18972 | 144960 | memset(temp_colordata, 0, 48); | |
| 18973 | |||
| 18974 |
1/2✓ Branch 0 taken 144960 times.
✗ Branch 1 not taken.
|
144960 | if(!pfread(temp_colordata,48,f)) |
| 18975 | { | ||
| 18976 | ✗ | return qe_invalid; | |
| 18977 | } | ||
| 18978 | |||
| 18979 |
2/2✓ Branch 0 taken 240 times.
✓ Branch 1 taken 144720 times.
|
144960 | if (should_skip) |
| 18980 | 240 | continue; | |
| 18981 | |||
| 18982 | 144720 | memcpy(&colordata[q*48], temp_colordata, 48); | |
| 18983 | |||
| 18984 | 144720 | ++q; | |
| 18985 |
8/8✓ Branch 0 taken 135072 times.
✓ Branch 1 taken 9648 times.
✓ Branch 2 taken 10251 times.
✓ Branch 3 taken 124821 times.
✓ Branch 4 taken 1206 times.
✓ Branch 5 taken 9045 times.
✓ Branch 6 taken 36 times.
✓ Branch 7 taken 1170 times.
|
144720 | if (p > 0 && (p%13)==12 && (i < oldpoSPRITE || !RealOldVerion)) //It's > 0 instead of >= 0 because it should append |
| 18986 | { | ||
| 18987 |
1/2✓ Branch 0 taken 10215 times.
✗ Branch 1 not taken.
|
10215 | if (s_version < 5) //Bumping up the size of level palettes |
| 18988 | { | ||
| 18989 | 10215 | memcpy(&colordata[(q)*48], &colordata[1*48], 48); | |
| 18990 | 10215 | memcpy(&colordata[(q+1)*48], &colordata[5*48], 48); | |
| 18991 | 10215 | memcpy(&colordata[(q+2)*48], &colordata[7*48], 48); | |
| 18992 | 10215 | memcpy(&colordata[(q+3)*48], &colordata[8*48], 48); | |
| 18993 | 10215 | q+=4; | |
| 18994 | 10215 | } | |
| 18995 | else | ||
| 18996 | { | ||
| 18997 | ✗ | for(int m = 0; m < 4; ++m) | |
| 18998 | { | ||
| 18999 | ✗ | memset(temp_colordata, 0, 48); | |
| 19000 | ✗ | if(!pfread(temp_colordata,48,f)) | |
| 19001 | { | ||
| 19002 | ✗ | return qe_invalid; | |
| 19003 | } | ||
| 19004 | ✗ | memcpy(&colordata[q*48], temp_colordata, 48); | |
| 19005 | ✗ | ++q; | |
| 19006 | ✗ | } | |
| 19007 | } | ||
| 19008 | 10215 | } | |
| 19009 | 144720 | ++p; | |
| 19010 | 144720 | } | |
| 19011 | |||
| 19012 |
2/2✓ Branch 0 taken 18 times.
✓ Branch 1 taken 586 times.
|
604 | if(RealOldVerion) |
| 19013 | { | ||
| 19014 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 18 times.
|
18 | if (!should_skip) |
| 19015 | { | ||
| 19016 | 18 | memcpy(colordata+(poSPRITE255*48), colordata+((q-30)*48), 30*16*3); | |
| 19017 | 18 | memset(colordata+((q-30)*48), 0, ((poSPRITE255-(q-30))*48)); | |
| 19018 | 18 | memcpy(colordata+((poSPRITE255+11)*48), colordata+((poSPRITE255+10)*48), 48); | |
| 19019 | 18 | memcpy(colordata+((poSPRITE255+10)*48), colordata+((poSPRITE255+9)*48), 48); | |
| 19020 | 18 | memcpy(colordata+((poSPRITE255+9)*48), colordata+((poSPRITE255+8)*48), 48); | |
| 19021 | 18 | memset(colordata+((poSPRITE255+8)*48), 0, 48); | |
| 19022 | 18 | } | |
| 19023 | 18 | } | |
| 19024 | else | ||
| 19025 | { | ||
| 19026 | 586 | memset(temp_colordata, 0, 48); | |
| 19027 | |||
| 19028 |
2/2✓ Branch 0 taken 1835938 times.
✓ Branch 1 taken 586 times.
|
1836524 | for(int32_t i=0; i<newpdTOTAL-oldpdTOTAL; ++i) |
| 19029 | { | ||
| 19030 |
1/2✓ Branch 0 taken 1835938 times.
✗ Branch 1 not taken.
|
1835938 | if(!pfread(temp_colordata,48,f)) |
| 19031 | { | ||
| 19032 | ✗ | return qe_invalid; | |
| 19033 | } | ||
| 19034 | |||
| 19035 |
2/2✓ Branch 0 taken 3133 times.
✓ Branch 1 taken 1832805 times.
|
1835938 | if (should_skip) |
| 19036 | 3133 | continue; | |
| 19037 | |||
| 19038 | 1832805 | memcpy(&colordata[q*48], temp_colordata, 48); | |
| 19039 | |||
| 19040 | 1832805 | ++q; | |
| 19041 |
7/8✓ Branch 0 taken 1832805 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 140985 times.
✓ Branch 3 taken 1691820 times.
✓ Branch 4 taken 1170 times.
✓ Branch 5 taken 139815 times.
✓ Branch 6 taken 1042 times.
✓ Branch 7 taken 128 times.
|
1832805 | if (p > 0 && (p%13)==12 && (i < (newpoSPRITE-oldpdTOTAL) || (s_version >= 4))) //It's > 0 instead of >= 0 because it should append |
| 19042 | { | ||
| 19043 |
1/2✓ Branch 0 taken 140857 times.
✗ Branch 1 not taken.
|
140857 | if (s_version < 5) //Bumping up the size of level palettes |
| 19044 | { | ||
| 19045 | 140857 | memcpy(&colordata[(q)*48], &colordata[1*48], 48); | |
| 19046 | 140857 | memcpy(&colordata[(q+1)*48], &colordata[5*48], 48); | |
| 19047 | 140857 | memcpy(&colordata[(q+2)*48], &colordata[7*48], 48); | |
| 19048 | 140857 | memcpy(&colordata[(q+3)*48], &colordata[8*48], 48); | |
| 19049 | 140857 | q+=4; | |
| 19050 | 140857 | } | |
| 19051 | else | ||
| 19052 | { | ||
| 19053 | ✗ | for(int m = 0; m < 4; ++m) | |
| 19054 | { | ||
| 19055 | ✗ | memset(temp_colordata, 0, 48); | |
| 19056 | ✗ | if(!pfread(temp_colordata,48,f)) | |
| 19057 | { | ||
| 19058 | ✗ | return qe_invalid; | |
| 19059 | } | ||
| 19060 | ✗ | memcpy(&colordata[q*48], temp_colordata, 48); | |
| 19061 | ✗ | ++q; | |
| 19062 | ✗ | } | |
| 19063 | } | ||
| 19064 | 140857 | } | |
| 19065 | 1832805 | ++p; | |
| 19066 | 1832805 | } | |
| 19067 | |||
| 19068 |
2/2✓ Branch 0 taken 65 times.
✓ Branch 1 taken 521 times.
|
586 | if(s_version < 4) |
| 19069 | { | ||
| 19070 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 64 times.
|
65 | if (!should_skip) |
| 19071 | { | ||
| 19072 | 64 | memcpy(colordata+(poSPRITE255*48), colordata+((q-30)*48), 30*16*3); | |
| 19073 | 64 | memset(colordata+((q-30)*48), 0, ((poSPRITE255-(q-30))*48)); | |
| 19074 | 64 | } | |
| 19075 | 65 | } | |
| 19076 | else | ||
| 19077 | { | ||
| 19078 |
2/2✓ Branch 0 taken 1733888 times.
✓ Branch 1 taken 521 times.
|
1734409 | for(int32_t i=0; i<newerpdTOTAL-newpdTOTAL; ++i) |
| 19079 | { | ||
| 19080 |
1/2✓ Branch 0 taken 1733888 times.
✗ Branch 1 not taken.
|
1733888 | if(!pfread(temp_colordata,48,f)) |
| 19081 | { | ||
| 19082 | ✗ | return qe_invalid; | |
| 19083 | } | ||
| 19084 | |||
| 19085 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1733888 times.
|
1733888 | if (should_skip) |
| 19086 | ✗ | continue; | |
| 19087 | |||
| 19088 | 1733888 | memcpy(&colordata[q*48], temp_colordata, 48); | |
| 19089 | 1733888 | ++q; | |
| 19090 |
5/6✓ Branch 0 taken 1733888 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 133376 times.
✓ Branch 3 taken 1600512 times.
✓ Branch 4 taken 1042 times.
✓ Branch 5 taken 132334 times.
|
1733888 | if (p > 0 && (p%13)==12 && i < newerpoSPRITE-newpdTOTAL) //It's > 0 instead of >= 0 because it should append |
| 19091 | { | ||
| 19092 |
1/2✓ Branch 0 taken 132334 times.
✗ Branch 1 not taken.
|
132334 | if (s_version < 5) //Bumping up the size of level palettes |
| 19093 | { | ||
| 19094 | 132334 | memcpy(&colordata[(q)*48], &colordata[1*48], 48); | |
| 19095 | 132334 | memcpy(&colordata[(q+1)*48], &colordata[5*48], 48); | |
| 19096 | 132334 | memcpy(&colordata[(q+2)*48], &colordata[7*48], 48); | |
| 19097 | 132334 | memcpy(&colordata[(q+3)*48], &colordata[8*48], 48); | |
| 19098 | 132334 | q+=4; | |
| 19099 | 132334 | } | |
| 19100 | else | ||
| 19101 | { | ||
| 19102 | ✗ | for(int m = 0; m < 4; ++m) | |
| 19103 | { | ||
| 19104 | ✗ | memset(temp_colordata, 0, 48); | |
| 19105 | ✗ | if(!pfread(temp_colordata,48,f)) | |
| 19106 | { | ||
| 19107 | ✗ | return qe_invalid; | |
| 19108 | } | ||
| 19109 | ✗ | memcpy(&colordata[q*48], temp_colordata, 48); | |
| 19110 | ✗ | ++q; | |
| 19111 | ✗ | } | |
| 19112 | } | ||
| 19113 | 132334 | } | |
| 19114 | 1733888 | ++p; | |
| 19115 | 1733888 | } | |
| 19116 | |||
| 19117 | //By this point, q should be about equal to pdTOTAL255. If it isn't, I've fucked up. -Deedee | ||
| 19118 | } | ||
| 19119 | } | ||
| 19120 | 604 | } | |
| 19121 | else | ||
| 19122 | { | ||
| 19123 |
2/2✓ Branch 0 taken 1714804 times.
✓ Branch 1 taken 196 times.
|
1715000 | for(int32_t i=0; i<pdTOTAL255; ++i) |
| 19124 | { | ||
| 19125 | 1714804 | memset(temp_colordata, 0, 48); | |
| 19126 | |||
| 19127 |
1/2✓ Branch 0 taken 1714804 times.
✗ Branch 1 not taken.
|
1714804 | if(!pfread(temp_colordata,48,f)) |
| 19128 | { | ||
| 19129 | ✗ | return qe_invalid; | |
| 19130 | } | ||
| 19131 | |||
| 19132 | 1714804 | memcpy(&colordata[i*48], temp_colordata, 48); | |
| 19133 | 1714804 | } | |
| 19134 | } | ||
| 19135 | |||
| 19136 |
4/4✓ Branch 0 taken 799 times.
✓ Branch 1 taken 1 times.
✓ Branch 2 taken 152 times.
✓ Branch 3 taken 647 times.
|
800 | if (!should_skip && s_version < 6) |
| 19137 | { | ||
| 19138 |
2/2✓ Branch 0 taken 271708944 times.
✓ Branch 1 taken 647 times.
|
271709591 | for (int i = 0; i < psTOTAL255; i++) |
| 19139 | { | ||
| 19140 | 271708944 | colordata[i] = _rgb_scale_6[colordata[i]]; | |
| 19141 | 271708944 | } | |
| 19142 | 647 | } | |
| 19143 | |||
| 19144 |
5/6✓ Branch 0 taken 782 times.
✓ Branch 1 taken 18 times.
✓ Branch 2 taken 6 times.
✓ Branch 3 taken 776 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 6 times.
|
800 | if((version < 0x192)||((version == 0x192)&&(build<76))) |
| 19145 | { | ||
| 19146 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 18 times.
|
18 | if (!should_skip) |
| 19147 | 18 | init_palnames(); | |
| 19148 | 18 | } | |
| 19149 | else | ||
| 19150 | { | ||
| 19151 | 782 | int32_t palnamestoread = 0; | |
| 19152 | |||
| 19153 |
2/2✓ Branch 0 taken 65 times.
✓ Branch 1 taken 717 times.
|
782 | if(s_version < 3) |
| 19154 | 65 | palnamestoread = OLDMAXLEVELS; | |
| 19155 | else | ||
| 19156 | 717 | palnamestoread = 512; | |
| 19157 | |||
| 19158 |
2/2✓ Branch 0 taken 383744 times.
✓ Branch 1 taken 782 times.
|
384526 | for(int32_t i=0; i<palnamestoread; ++i) |
| 19159 | { | ||
| 19160 |
1/2✓ Branch 0 taken 383744 times.
✗ Branch 1 not taken.
|
383744 | if(!p_getstr(temp_palname,PALNAMESIZE,f)) |
| 19161 | { | ||
| 19162 | ✗ | return qe_invalid; | |
| 19163 | } | ||
| 19164 | |||
| 19165 |
2/2✓ Branch 0 taken 256 times.
✓ Branch 1 taken 383488 times.
|
383744 | if (!should_skip) |
| 19166 | 383488 | memcpy(palnames[i], temp_palname, PALNAMESIZE); | |
| 19167 | 383744 | } | |
| 19168 | |||
| 19169 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 781 times.
|
782 | if (should_skip) |
| 19170 | 1 | return 0; | |
| 19171 | |||
| 19172 |
2/2✓ Branch 0 taken 16384 times.
✓ Branch 1 taken 781 times.
|
17165 | for(int32_t i=palnamestoread; i<MAXLEVELS; i++) |
| 19173 | { | ||
| 19174 | 16384 | memset(palnames[i], 0, PALNAMESIZE); | |
| 19175 | 16384 | } | |
| 19176 | } | ||
| 19177 | |||
| 19178 |
2/2✓ Branch 0 taken 23 times.
✓ Branch 1 taken 776 times.
|
799 | if(version > 0x192) |
| 19179 | { | ||
| 19180 |
2/2✓ Branch 0 taken 198656 times.
✓ Branch 1 taken 776 times.
|
199432 | for(int32_t i=0; i<256; i++) |
| 19181 | { | ||
| 19182 |
2/2✓ Branch 0 taken 595968 times.
✓ Branch 1 taken 198656 times.
|
794624 | for(int32_t j=0; j<3; j++) |
| 19183 | { | ||
| 19184 | 595968 | temp_misc.cycles[i][j].first=0; | |
| 19185 | 595968 | temp_misc.cycles[i][j].count=0; | |
| 19186 | 595968 | temp_misc.cycles[i][j].speed=0; | |
| 19187 | 595968 | } | |
| 19188 | 198656 | } | |
| 19189 | |||
| 19190 |
1/2✓ Branch 0 taken 776 times.
✗ Branch 1 not taken.
|
776 | if(!p_igetw(&palcycles,f)) |
| 19191 | { | ||
| 19192 | ✗ | return qe_invalid; | |
| 19193 | } | ||
| 19194 | |||
| 19195 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 776 times.
|
776 | if (palcycles > NUM_PAL_CYCLES) |
| 19196 | { | ||
| 19197 | ✗ | return qe_invalid; | |
| 19198 | } | ||
| 19199 | |||
| 19200 |
2/2✓ Branch 0 taken 21857 times.
✓ Branch 1 taken 776 times.
|
22633 | for(int32_t i=0; i<palcycles; i++) |
| 19201 | { | ||
| 19202 |
2/2✓ Branch 0 taken 65571 times.
✓ Branch 1 taken 21857 times.
|
87428 | for(int32_t j=0; j<3; j++) |
| 19203 | { | ||
| 19204 |
1/2✓ Branch 0 taken 65571 times.
✗ Branch 1 not taken.
|
65571 | if(!p_getc(&temp_misc.cycles[i][j].first,f)) |
| 19205 | { | ||
| 19206 | ✗ | return qe_invalid; | |
| 19207 | } | ||
| 19208 | 65571 | } | |
| 19209 | |||
| 19210 |
2/2✓ Branch 0 taken 65571 times.
✓ Branch 1 taken 21857 times.
|
87428 | for(int32_t j=0; j<3; j++) |
| 19211 | { | ||
| 19212 |
1/2✓ Branch 0 taken 65571 times.
✗ Branch 1 not taken.
|
65571 | if(!p_getc(&temp_misc.cycles[i][j].count,f)) |
| 19213 | { | ||
| 19214 | ✗ | return qe_invalid; | |
| 19215 | } | ||
| 19216 | 65571 | } | |
| 19217 | |||
| 19218 |
2/2✓ Branch 0 taken 65571 times.
✓ Branch 1 taken 21857 times.
|
87428 | for(int32_t j=0; j<3; j++) |
| 19219 | { | ||
| 19220 |
1/2✓ Branch 0 taken 65571 times.
✗ Branch 1 not taken.
|
65571 | if(!p_getc(&temp_misc.cycles[i][j].speed,f)) |
| 19221 | { | ||
| 19222 | ✗ | return qe_invalid; | |
| 19223 | } | ||
| 19224 | 65571 | } | |
| 19225 | 21857 | } | |
| 19226 | |||
| 19227 | 776 | memcpy(Misc, &temp_misc, sizeof(temp_misc)); | |
| 19228 | 776 | } | |
| 19229 | |||
| 19230 | 799 | return 0; | |
| 19231 | 800 | } | |
| 19232 | |||
| 19233 | 800 | int32_t readtiles(PACKFILE *f, tiledata *buf, zquestheader *Header, word version, word build, word start_tile, int32_t max_tiles, bool from_init) | |
| 19234 | { | ||
| 19235 |
2/2✓ Branch 0 taken 776 times.
✓ Branch 1 taken 24 times.
|
800 | bool should_skip = legacy_skip_flags && get_bit(legacy_skip_flags, skip_tiles); |
| 19236 | |||
| 19237 | 800 | int32_t tiles_used=0; | |
| 19238 | 800 | word section_version = 0; | |
| 19239 | 800 | int32_t section_size= 0; | |
| 19240 | 800 | byte *temp_tile = new byte[tilesize(tf32Bit)]; | |
| 19241 | |||
| 19242 | //Tile Expansion | ||
| 19243 | //if ( version >= 0x254 && build >= 41 ) | ||
| 19244 |
4/4✓ Branch 0 taken 604 times.
✓ Branch 1 taken 196 times.
✓ Branch 2 taken 6 times.
✓ Branch 3 taken 598 times.
|
800 | if (version < 0x254 && build < 41) |
| 19245 | { | ||
| 19246 | 598 | max_tiles = ZC250MAXTILES; | |
| 19247 | 598 | } | |
| 19248 | |||
| 19249 | |||
| 19250 |
2/6✓ Branch 0 taken 800 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 800 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
800 | if(Header!=NULL&&(!Header->data_flags[ZQ_TILES]&&!from_init)) //keep for old quests |
| 19251 | { | ||
| 19252 | ✗ | if(!init_tiles_for_190(true, Header)) | |
| 19253 | { | ||
| 19254 | ✗ | al_trace("Unable to initialize tiles\n"); | |
| 19255 | ✗ | } | |
| 19256 | |||
| 19257 | ✗ | delete[] temp_tile; | |
| 19258 | ✗ | temp_tile=NULL; | |
| 19259 | ✗ | return 0; | |
| 19260 | } | ||
| 19261 | else | ||
| 19262 | { | ||
| 19263 |
2/2✓ Branch 0 taken 24 times.
✓ Branch 1 taken 776 times.
|
800 | if(version > 0x192) |
| 19264 | { | ||
| 19265 | //section version info | ||
| 19266 |
1/2✓ Branch 0 taken 776 times.
✗ Branch 1 not taken.
|
776 | if(!p_igetw(§ion_version,f)) |
| 19267 | { | ||
| 19268 | ✗ | delete[] temp_tile; | |
| 19269 | ✗ | return qe_invalid; | |
| 19270 | } | ||
| 19271 | |||
| 19272 | 776 | FFCore.quest_format[vTiles] = section_version; | |
| 19273 | |||
| 19274 |
1/2✓ Branch 0 taken 776 times.
✗ Branch 1 not taken.
|
776 | if(!read_deprecated_section_cversion(f)) |
| 19275 | { | ||
| 19276 | ✗ | delete[] temp_tile; | |
| 19277 | ✗ | return qe_invalid; | |
| 19278 | } | ||
| 19279 | |||
| 19280 | //section size | ||
| 19281 |
1/2✓ Branch 0 taken 776 times.
✗ Branch 1 not taken.
|
776 | if(!p_igetl(§ion_size,f)) |
| 19282 | { | ||
| 19283 | ✗ | delete[] temp_tile; | |
| 19284 | ✗ | return qe_invalid; | |
| 19285 | } | ||
| 19286 | 776 | } | |
| 19287 | |||
| 19288 | //if ( build < 41 ) | ||
| 19289 | //{ | ||
| 19290 | // tiles_used = ZC250MAXTILES; | ||
| 19291 | //} | ||
| 19292 | |||
| 19293 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 800 times.
|
800 | if(version < 0x174) |
| 19294 | { | ||
| 19295 | ✗ | tiles_used=TILES_PER_PAGE*4; | |
| 19296 | ✗ | } //no expanded tile space | |
| 19297 |
2/2✓ Branch 0 taken 18 times.
✓ Branch 1 taken 782 times.
|
800 | else if(version < 0x191) |
| 19298 | { | ||
| 19299 | 18 | tiles_used=OLDMAXTILES; | |
| 19300 | 18 | } | |
| 19301 | else | ||
| 19302 | { | ||
| 19303 | //finally... section data | ||
| 19304 |
3/4✓ Branch 0 taken 196 times.
✓ Branch 1 taken 586 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 196 times.
|
782 | if ( version >= 0x254 && build >= 41 ) //read and write the size of tiles_used properly |
| 19305 | { | ||
| 19306 |
1/2✓ Branch 0 taken 196 times.
✗ Branch 1 not taken.
|
196 | if(!p_igetl(&tiles_used,f)) |
| 19307 | { | ||
| 19308 | ✗ | delete[] temp_tile; | |
| 19309 | ✗ | return qe_invalid; | |
| 19310 | } | ||
| 19311 | 196 | } | |
| 19312 | else | ||
| 19313 | { | ||
| 19314 |
1/2✓ Branch 0 taken 586 times.
✗ Branch 1 not taken.
|
586 | if(!p_igetw(&tiles_used,f)) |
| 19315 | { | ||
| 19316 | ✗ | delete[] temp_tile; | |
| 19317 | ✗ | return qe_invalid; | |
| 19318 | } | ||
| 19319 | } | ||
| 19320 | } | ||
| 19321 | |||
| 19322 |
1/2✓ Branch 0 taken 800 times.
✗ Branch 1 not taken.
|
800 | tiles_used=zc_min(tiles_used, max_tiles); |
| 19323 | |||
| 19324 | //if ( version < 0x254 || ( version >= 0x254 && build < 41 )) //don't do this, it crashes ZQuest. -Z | ||
| 19325 | //if ( version < 0x254 && build < 41 ) | ||
| 19326 |
3/6✓ Branch 0 taken 196 times.
✓ Branch 1 taken 604 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 196 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
800 | if ( version < 0x254 || (version == 0x254 && build < 41) ) |
| 19327 | //if ( build < 41 ) | ||
| 19328 | { | ||
| 19329 |
1/2✓ Branch 0 taken 604 times.
✗ Branch 1 not taken.
|
604 | tiles_used=zc_min(tiles_used, ZC250MAXTILES-start_tile); |
| 19330 | 604 | } | |
| 19331 | else //2.55 | ||
| 19332 | { | ||
| 19333 |
1/2✓ Branch 0 taken 196 times.
✗ Branch 1 not taken.
|
196 | tiles_used = zc_min(tiles_used,NEWMAXTILES-start_tile); |
| 19334 | } | ||
| 19335 | |||
| 19336 | //if ( section_version > 1 ) tiles_used = NEWMAXTILES; | ||
| 19337 | |||
| 19338 | |||
| 19339 |
2/2✓ Branch 0 taken 18291902 times.
✓ Branch 1 taken 800 times.
|
18292702 | for(int32_t i=0; i<tiles_used; ++i) |
| 19340 | { | ||
| 19341 | 18291902 | byte format=tf4Bit; | |
| 19342 | 18291902 | memset(temp_tile, 0, tilesize(tf32Bit)); | |
| 19343 | |||
| 19344 |
3/6✓ Branch 0 taken 2985456 times.
✓ Branch 1 taken 15306446 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 2985456 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
18291902 | if((version>0x211)||((version==0x211)&&(build>4))) |
| 19345 | { | ||
| 19346 |
1/2✓ Branch 0 taken 15306446 times.
✗ Branch 1 not taken.
|
15306446 | if(!p_getc(&format,f)) |
| 19347 | { | ||
| 19348 | ✗ | delete[] temp_tile; | |
| 19349 | ✗ | return qe_invalid; | |
| 19350 | } | ||
| 19351 | 15306446 | } | |
| 19352 |
4/4✓ Branch 0 taken 7523740 times.
✓ Branch 1 taken 10768162 times.
✓ Branch 2 taken 3442623 times.
✓ Branch 3 taken 4081117 times.
|
18291902 | if(section_version > 2 && !format) |
| 19353 | { | ||
| 19354 | 4081117 | reset_tile(buf,start_tile+i,tf4Bit); | |
| 19355 | 4081117 | continue; | |
| 19356 | } | ||
| 19357 | |||
| 19358 |
2/2✓ Branch 0 taken 13738564 times.
✓ Branch 1 taken 472221 times.
|
14210785 | int size = format == tf4Bit ? 128 : tilesize(format); |
| 19359 |
1/2✓ Branch 0 taken 14210785 times.
✗ Branch 1 not taken.
|
14210785 | if(!pfread(temp_tile,size,f)) |
| 19360 | { | ||
| 19361 | ✗ | delete[] temp_tile; | |
| 19362 | ✗ | return qe_invalid; | |
| 19363 | } | ||
| 19364 | |||
| 19365 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 14210785 times.
|
14210785 | if (should_skip) |
| 19366 | ✗ | continue; | |
| 19367 | |||
| 19368 | 14210785 | buf[start_tile+i].format=format; | |
| 19369 | |||
| 19370 |
2/2✓ Branch 0 taken 14006900 times.
✓ Branch 1 taken 203885 times.
|
14210785 | if(buf[start_tile+i].data) |
| 19371 | { | ||
| 19372 | 14006900 | free(buf[start_tile+i].data); | |
| 19373 | 14006900 | buf[start_tile+i].data=NULL; | |
| 19374 | 14006900 | } | |
| 19375 | |||
| 19376 | 14210785 | buf[start_tile+i].data=(byte *)malloc(tilesize(buf[start_tile+i].format)); | |
| 19377 | |||
| 19378 |
2/2✓ Branch 0 taken 13738564 times.
✓ Branch 1 taken 472221 times.
|
14210785 | if (format == tf4Bit) |
| 19379 | { | ||
| 19380 | byte temp[256]; | ||
| 19381 | 13738564 | byte *si = temp_tile + 128; | |
| 19382 | 13738564 | byte *di = temp + 256; | |
| 19383 | |||
| 19384 |
2/2✓ Branch 0 taken 1758536192 times.
✓ Branch 1 taken 13738564 times.
|
1772274756 | for(int i=127; i>=0; --i) |
| 19385 | { | ||
| 19386 | 1758536192 | (*(--di)) = (*(--si)) >> 4; | |
| 19387 | 1758536192 | (*(--di)) = (*si) & 15; | |
| 19388 | 1758536192 | } | |
| 19389 | |||
| 19390 | 13738564 | memcpy(buf[start_tile+i].data,temp,256); | |
| 19391 | 13738564 | } | |
| 19392 | else | ||
| 19393 | { | ||
| 19394 | 472221 | memcpy(buf[start_tile+i].data,temp_tile,tilesize(buf[start_tile+i].format)); | |
| 19395 | } | ||
| 19396 | 14210785 | } | |
| 19397 | } | ||
| 19398 | |||
| 19399 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 800 times.
|
800 | if (should_skip) |
| 19400 | ✗ | return 0; | |
| 19401 | |||
| 19402 |
2/2✓ Branch 0 taken 196 times.
✓ Branch 1 taken 604 times.
|
800 | if ( section_version < 2 ) //write blank tile data --check s_version with this again instead? |
| 19403 | { | ||
| 19404 |
2/2✓ Branch 0 taken 89983920 times.
✓ Branch 1 taken 604 times.
|
89984524 | for ( int32_t q = ZC250MAXTILES; q < NEWMAXTILES; ++q ) |
| 19405 | { | ||
| 19406 | |||
| 19407 | //memcpy(buf[q].data,temp_tile,tilesize(buf[q].format)); | ||
| 19408 | 89983920 | reset_tile(buf,q,tf4Bit); | |
| 19409 | |||
| 19410 | |||
| 19411 | /* | ||
| 19412 | |||
| 19413 | byte tempbyte; | ||
| 19414 | for(int32_t i=0; i<tilesize(tf4Bit); i++) | ||
| 19415 | { | ||
| 19416 | tempbyte=buf[ZC250MAXTILES-1].data[i]; | ||
| 19417 | buf[q].data[i] = tempbyte; | ||
| 19418 | } | ||
| 19419 | //int32_t temp = tempbyte=buf[130].data[i]; | ||
| 19420 | //buf[q].data = buf[ZC250MAXTILES-1].data; | ||
| 19421 | */ | ||
| 19422 | //reset_tile(buf,q,tf4Bit); | ||
| 19423 | 89983920 | } | |
| 19424 | |||
| 19425 | 604 | } | |
| 19426 | |||
| 19427 |
4/6✓ Branch 0 taken 196 times.
✓ Branch 1 taken 604 times.
✓ Branch 2 taken 196 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 196 times.
|
800 | if ( version < 0x254 || ( version >= 0x254 && build < 41 )) |
| 19428 | { | ||
| 19429 |
2/2✓ Branch 0 taken 30117038 times.
✓ Branch 1 taken 604 times.
|
30117642 | for(int32_t i=start_tile+tiles_used; i<max_tiles; ++i) |
| 19430 | { | ||
| 19431 | 30117038 | reset_tile(buf,i,tf4Bit); | |
| 19432 | 30117038 | } | |
| 19433 | 604 | } | |
| 19434 | else | ||
| 19435 | { | ||
| 19436 |
2/2✓ Branch 0 taken 34101020 times.
✓ Branch 1 taken 196 times.
|
34101216 | for(int32_t i=start_tile+tiles_used; i<max_tiles; ++i) |
| 19437 | { | ||
| 19438 | 34101020 | reset_tile(buf,i,tf4Bit); | |
| 19439 | 34101020 | } | |
| 19440 | } | ||
| 19441 | |||
| 19442 |
5/6✓ Branch 0 taken 782 times.
✓ Branch 1 taken 18 times.
✓ Branch 2 taken 6 times.
✓ Branch 3 taken 776 times.
✓ Branch 4 taken 6 times.
✗ Branch 5 not taken.
|
800 | if((version < 0x192)|| ((version == 0x192)&&(build<186))) |
| 19443 | { | ||
| 19444 |
2/2✓ Branch 0 taken 18 times.
✓ Branch 1 taken 6 times.
|
24 | if(get_qr(qr_BSZELDA)) // |
| 19445 | { | ||
| 19446 | byte tempbyte; | ||
| 19447 | 6 | int32_t floattile=wpnsbuf[iwSwim].tile; | |
| 19448 | |||
| 19449 |
2/2✓ Branch 0 taken 1536 times.
✓ Branch 1 taken 6 times.
|
1542 | for(int32_t i=0; i<tilesize(tf4Bit); i++) //BSZelda tiles are out of order //does this include swim tiles? |
| 19450 | { | ||
| 19451 | 1536 | tempbyte=buf[23].data[i]; | |
| 19452 | 1536 | buf[23].data[i]=buf[24].data[i]; | |
| 19453 | 1536 | buf[24].data[i]=buf[25].data[i]; | |
| 19454 | 1536 | buf[25].data[i]=buf[26].data[i]; | |
| 19455 | 1536 | buf[26].data[i]=tempbyte; | |
| 19456 | 1536 | } | |
| 19457 | //swim tiles are out of order, too, but nobody cared? -Z | ||
| 19458 |
2/2✓ Branch 0 taken 1536 times.
✓ Branch 1 taken 6 times.
|
1542 | for(int32_t i=0; i<tilesize(tf4Bit); i++) |
| 19459 | { | ||
| 19460 | 1536 | tempbyte=buf[floattile+11].data[i]; | |
| 19461 | 1536 | buf[floattile+11].data[i]=buf[floattile+12].data[i]; | |
| 19462 | 1536 | buf[floattile+12].data[i]=tempbyte; | |
| 19463 | 1536 | } | |
| 19464 | 6 | } | |
| 19465 | 24 | } | |
| 19466 | |||
| 19467 |
3/6✓ Branch 0 taken 717 times.
✓ Branch 1 taken 83 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 717 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
800 | if((version < 0x211)||((version == 0x211)&&(build<7))) //Goriya tiles are out of order |
| 19468 | { | ||
| 19469 |
2/2✓ Branch 0 taken 61 times.
✓ Branch 1 taken 22 times.
|
83 | if(!get_qr(qr_NEWENEMYTILES)) |
| 19470 | { | ||
| 19471 | byte tempbyte; | ||
| 19472 | |||
| 19473 |
2/2✓ Branch 0 taken 5632 times.
✓ Branch 1 taken 22 times.
|
5654 | for(int32_t i=0; i<tilesize(tf4Bit); i++) |
| 19474 | { | ||
| 19475 | 5632 | tempbyte=buf[130].data[i]; | |
| 19476 | 5632 | buf[130].data[i]=buf[132].data[i]; | |
| 19477 | 5632 | buf[132].data[i]=tempbyte; | |
| 19478 | |||
| 19479 | 5632 | tempbyte=buf[131].data[i]; | |
| 19480 | 5632 | buf[131].data[i]=buf[133].data[i]; | |
| 19481 | 5632 | buf[133].data[i]=tempbyte; | |
| 19482 | 5632 | } | |
| 19483 | 22 | } | |
| 19484 | 83 | } | |
| 19485 | |||
| 19486 | 800 | al_trace("Registering blank tiles\n"); | |
| 19487 | 800 | register_blank_tiles(); | |
| 19488 | |||
| 19489 | //memset(temp_tile, 0, tilesize(tf32Bit)); | ||
| 19490 |
1/2✓ Branch 0 taken 800 times.
✗ Branch 1 not taken.
|
800 | delete[] temp_tile; |
| 19491 | 800 | temp_tile=NULL; | |
| 19492 | 800 | return 0; | |
| 19493 | 800 | } | |
| 19494 | |||
| 19495 | 478 | int32_t readtunes(PACKFILE *f, zquestheader *Header, zctune *tunes /*zcmidi_ *midis*/) | |
| 19496 | { | ||
| 19497 |
2/2✓ Branch 0 taken 455 times.
✓ Branch 1 taken 23 times.
|
478 | bool should_skip = legacy_skip_flags && get_bit(legacy_skip_flags, skip_midis); |
| 19498 | |||
| 19499 | static byte fake_midi_flags[32]; | ||
| 19500 | |||
| 19501 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 478 times.
|
478 | byte *mf=should_skip ? fake_midi_flags : midi_flags; |
| 19502 | int32_t dummy; | ||
| 19503 | word dummy2; | ||
| 19504 | // zcmidi_ temp_midi; | ||
| 19505 | int32_t tunes_to_read; | ||
| 19506 | 478 | int32_t tune_count=0; | |
| 19507 | 478 | word section_version=0; | |
| 19508 | 478 | zctune temp; | |
| 19509 | |||
| 19510 |
2/2✓ Branch 0 taken 23 times.
✓ Branch 1 taken 455 times.
|
478 | if(Header->zelda_version < 0x193) |
| 19511 | { | ||
| 19512 | // mf=Header->data_flags+ZQ_MIDIS2; | ||
| 19513 |
5/6✓ Branch 0 taken 5 times.
✓ Branch 1 taken 18 times.
✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 4 times.
✓ Branch 5 taken 1 times.
|
23 | if((Header->zelda_version < 0x192)||((Header->zelda_version == 0x192)&&(Header->build<178))) |
| 19514 | { | ||
| 19515 | 22 | tunes_to_read=MAXCUSTOMMIDIS192b177; | |
| 19516 | 22 | } | |
| 19517 | else | ||
| 19518 | { | ||
| 19519 | 1 | tunes_to_read=MAXCUSTOMTUNES; | |
| 19520 | } | ||
| 19521 | 23 | } | |
| 19522 | else | ||
| 19523 | { | ||
| 19524 | //section version info | ||
| 19525 |
1/2✓ Branch 0 taken 455 times.
✗ Branch 1 not taken.
|
455 | if(!p_igetw(§ion_version,f)) |
| 19526 | { | ||
| 19527 | ✗ | return qe_invalid; | |
| 19528 | } | ||
| 19529 | |||
| 19530 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 455 times.
|
455 | if (!should_skip) |
| 19531 | 455 | FFCore.quest_format[vMIDIs] = section_version; | |
| 19532 | |||
| 19533 |
1/2✓ Branch 0 taken 455 times.
✗ Branch 1 not taken.
|
455 | if(!p_igetw(&dummy2,f)) |
| 19534 | { | ||
| 19535 | ✗ | return qe_invalid; | |
| 19536 | } | ||
| 19537 | |||
| 19538 | //section size | ||
| 19539 |
1/2✓ Branch 0 taken 455 times.
✗ Branch 1 not taken.
|
455 | if(!p_igetl(&dummy,f)) |
| 19540 | { | ||
| 19541 | ✗ | return qe_invalid; | |
| 19542 | } | ||
| 19543 | |||
| 19544 | //finally... section data | ||
| 19545 |
1/2✓ Branch 0 taken 455 times.
✗ Branch 1 not taken.
|
455 | if(!pfread(midi_flags,sizeof(midi_flags),f)) |
| 19546 | { | ||
| 19547 | ✗ | return qe_invalid; | |
| 19548 | } | ||
| 19549 | |||
| 19550 | 455 | tunes_to_read=MAXCUSTOMTUNES; | |
| 19551 | } | ||
| 19552 | |||
| 19553 |
2/2✓ Branch 0 taken 120456 times.
✓ Branch 1 taken 478 times.
|
120934 | for(int32_t i=0; i<MAXCUSTOMTUNES; ++i) |
| 19554 | { | ||
| 19555 |
2/2✓ Branch 0 taken 10195 times.
✓ Branch 1 taken 110261 times.
|
120456 | if(get_bit(mf, i)) |
| 19556 | { | ||
| 19557 | 10195 | ++tune_count; | |
| 19558 | 10195 | } | |
| 19559 | 120456 | } | |
| 19560 | |||
| 19561 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 478 times.
|
478 | if (!should_skip) |
| 19562 | 478 | reset_tunes(tunes); //reset_midis(midis); | |
| 19563 | |||
| 19564 |
2/2✓ Branch 0 taken 115616 times.
✓ Branch 1 taken 478 times.
|
116094 | for(int32_t i=0; i<tunes_to_read; i++) |
| 19565 | { | ||
| 19566 | 115616 | temp.clear(); //memset(&temp_midi,0,sizeof(zcmidi_)); | |
| 19567 | |||
| 19568 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 115616 times.
|
115616 | if (!should_skip) |
| 19569 | 115616 | tunes[i].reset(); // reset_midi(midis+i); | |
| 19570 | |||
| 19571 |
2/2✓ Branch 0 taken 105421 times.
✓ Branch 1 taken 10195 times.
|
115616 | if(get_bit(mf,i)) |
| 19572 | { | ||
| 19573 |
2/2✓ Branch 0 taken 2663 times.
✓ Branch 1 taken 7532 times.
|
10195 | if(section_version < 4) |
| 19574 | { | ||
| 19575 |
1/2✓ Branch 0 taken 2663 times.
✗ Branch 1 not taken.
|
2663 | if(!p_getstr(temp.title,20,f)) |
| 19576 | { | ||
| 19577 | ✗ | return qe_invalid; | |
| 19578 | } | ||
| 19579 | 2663 | } | |
| 19580 | else | ||
| 19581 | { | ||
| 19582 |
1/2✓ Branch 0 taken 7532 times.
✗ Branch 1 not taken.
|
7532 | if(!p_getstr(temp.title,sizeof(temp.title)-1,f)) |
| 19583 | { | ||
| 19584 | ✗ | return qe_invalid; | |
| 19585 | } | ||
| 19586 | } | ||
| 19587 | |||
| 19588 |
1/2✓ Branch 0 taken 10195 times.
✗ Branch 1 not taken.
|
10195 | if(!p_igetl(&temp.start,f)) |
| 19589 | { | ||
| 19590 | ✗ | return qe_invalid; | |
| 19591 | } | ||
| 19592 | |||
| 19593 |
1/2✓ Branch 0 taken 10195 times.
✗ Branch 1 not taken.
|
10195 | if(!p_igetl(&temp.loop_start,f)) |
| 19594 | { | ||
| 19595 | ✗ | return qe_invalid; | |
| 19596 | } | ||
| 19597 | |||
| 19598 |
1/2✓ Branch 0 taken 10195 times.
✗ Branch 1 not taken.
|
10195 | if(!p_igetl(&temp.loop_end,f)) |
| 19599 | { | ||
| 19600 | ✗ | return qe_invalid; | |
| 19601 | } | ||
| 19602 | |||
| 19603 |
1/2✓ Branch 0 taken 10195 times.
✗ Branch 1 not taken.
|
10195 | if(!p_igetw(&temp.loop,f)) |
| 19604 | { | ||
| 19605 | ✗ | return qe_invalid; | |
| 19606 | } | ||
| 19607 | |||
| 19608 |
1/2✓ Branch 0 taken 10195 times.
✗ Branch 1 not taken.
|
10195 | if(!p_igetw(&temp.volume,f)) |
| 19609 | { | ||
| 19610 | ✗ | return qe_invalid; | |
| 19611 | } | ||
| 19612 | |||
| 19613 |
2/2✓ Branch 0 taken 9946 times.
✓ Branch 1 taken 249 times.
|
10195 | if(Header->zelda_version < 0x193) |
| 19614 | { | ||
| 19615 |
1/2✓ Branch 0 taken 249 times.
✗ Branch 1 not taken.
|
249 | if(!p_igetl(&dummy,f)) |
| 19616 | { | ||
| 19617 | ✗ | return qe_invalid; | |
| 19618 | } | ||
| 19619 | 249 | } | |
| 19620 | |||
| 19621 |
2/2✓ Branch 0 taken 2663 times.
✓ Branch 1 taken 7532 times.
|
10195 | if(section_version >= 3) |
| 19622 | { | ||
| 19623 |
1/2✓ Branch 0 taken 7532 times.
✗ Branch 1 not taken.
|
7532 | if(!pfread(&temp.flags,sizeof(temp.flags),f)) |
| 19624 | { | ||
| 19625 | ✗ | return qe_invalid; | |
| 19626 | } | ||
| 19627 | 7532 | } | |
| 19628 | |||
| 19629 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 10195 times.
|
10195 | if (!should_skip) |
| 19630 | 10195 | tunes[i].copyfrom(temp); // memcpy(&midis[i], &temp_midi, sizeof(zcmidi_)); | |
| 19631 | |||
| 19632 |
2/2✓ Branch 0 taken 2663 times.
✓ Branch 1 taken 7532 times.
|
10195 | if(section_version < 2) //= 1 || (Header->zelda_version < 0x211) || (Header->zelda_version == 0x211 && Header->build < 18)) |
| 19633 | { | ||
| 19634 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2663 times.
|
2663 | if (should_skip) |
| 19635 | { | ||
| 19636 | ✗ | if (read_midi(f)==NULL) | |
| 19637 | { | ||
| 19638 | ✗ | return qe_invalid; | |
| 19639 | } | ||
| 19640 | |||
| 19641 | ✗ | continue; | |
| 19642 | } | ||
| 19643 | |||
| 19644 | // old format - a midi is a midi | ||
| 19645 |
1/2✓ Branch 0 taken 2663 times.
✗ Branch 1 not taken.
|
2663 | if((tunes[i].data=read_midi(f))==NULL) |
| 19646 | { | ||
| 19647 | ✗ | return qe_invalid; | |
| 19648 | } | ||
| 19649 | 2663 | } | |
| 19650 | else | ||
| 19651 | { | ||
| 19652 | byte format; | ||
| 19653 |
1/2✓ Branch 0 taken 7532 times.
✗ Branch 1 not taken.
|
7532 | if(!pfread(&format,sizeof(format),f)) |
| 19654 | { | ||
| 19655 | ✗ | return qe_invalid; | |
| 19656 | } | ||
| 19657 | |||
| 19658 | // MIDI is the only format saved here. | ||
| 19659 | // Never did more than MIDI for a zctune, and no plans to now. | ||
| 19660 |
1/2✓ Branch 0 taken 7532 times.
✗ Branch 1 not taken.
|
7532 | if (format != MFORMAT_MIDI) |
| 19661 | { | ||
| 19662 | ✗ | return qe_invalid; | |
| 19663 | } | ||
| 19664 | |||
| 19665 | 7532 | tunes[i].data = read_midi(f); | |
| 19666 |
1/2✓ Branch 0 taken 7532 times.
✗ Branch 1 not taken.
|
7532 | if (!tunes[i].data) |
| 19667 | { | ||
| 19668 | ✗ | return qe_invalid; | |
| 19669 | } | ||
| 19670 | } | ||
| 19671 | 10195 | } | |
| 19672 | 115616 | } | |
| 19673 | |||
| 19674 | 478 | return 0; | |
| 19675 | 478 | } | |
| 19676 | |||
| 19677 | 478 | int32_t readcheatcodes(PACKFILE *f, zquestheader *Header) | |
| 19678 | { | ||
| 19679 |
2/2✓ Branch 0 taken 455 times.
✓ Branch 1 taken 23 times.
|
478 | bool should_skip = legacy_skip_flags && get_bit(legacy_skip_flags, skip_cheats); |
| 19680 | |||
| 19681 | int32_t dummy; | ||
| 19682 | ZCHEATS tempzcheats; | ||
| 19683 | 478 | char temp_use_cheats=1; | |
| 19684 | 478 | memset(&tempzcheats, 0, sizeof(tempzcheats)); | |
| 19685 | 478 | word s_version = 0; | |
| 19686 | |||
| 19687 |
2/2✓ Branch 0 taken 23 times.
✓ Branch 1 taken 455 times.
|
478 | if(Header->zelda_version > 0x192) |
| 19688 | { | ||
| 19689 | //section version info | ||
| 19690 |
1/2✓ Branch 0 taken 455 times.
✗ Branch 1 not taken.
|
455 | if(!p_igetw(&s_version,f)) |
| 19691 | { | ||
| 19692 | ✗ | return qe_invalid; | |
| 19693 | } | ||
| 19694 | |||
| 19695 | 455 | FFCore.quest_format[vCheats] = s_version; | |
| 19696 |
1/2✓ Branch 0 taken 455 times.
✗ Branch 1 not taken.
|
455 | if(!p_igetw(&dummy,f)) |
| 19697 | { | ||
| 19698 | ✗ | return qe_invalid; | |
| 19699 | } | ||
| 19700 | |||
| 19701 | //section size | ||
| 19702 |
1/2✓ Branch 0 taken 455 times.
✗ Branch 1 not taken.
|
455 | if(!p_igetl(&dummy,f)) |
| 19703 | { | ||
| 19704 | ✗ | return qe_invalid; | |
| 19705 | } | ||
| 19706 | |||
| 19707 | //finally... section data | ||
| 19708 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 455 times.
|
455 | if(!p_getc(&temp_use_cheats,f)) |
| 19709 | { | ||
| 19710 | ✗ | return qe_invalid; | |
| 19711 | } | ||
| 19712 | 455 | } | |
| 19713 | |||
| 19714 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 478 times.
|
478 | if(Header->data_flags[ZQ_CHEATS2]) |
| 19715 | { | ||
| 19716 |
1/2✓ Branch 0 taken 478 times.
✗ Branch 1 not taken.
|
478 | if(!p_igetl(&tempzcheats.flags,f)) |
| 19717 | { | ||
| 19718 | ✗ | return qe_invalid; | |
| 19719 | } | ||
| 19720 | |||
| 19721 |
1/2✓ Branch 0 taken 478 times.
✗ Branch 1 not taken.
|
478 | if(!pfread(&tempzcheats.codes, sizeof(tempzcheats.codes),f)) |
| 19722 | { | ||
| 19723 | ✗ | return qe_invalid; | |
| 19724 | } | ||
| 19725 | 478 | } | |
| 19726 | |||
| 19727 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 478 times.
|
478 | if (should_skip) |
| 19728 | ✗ | return 0; | |
| 19729 | |||
| 19730 | 478 | memcpy(&zcheats, &tempzcheats, sizeof(tempzcheats)); | |
| 19731 | 478 | Header->data_flags[ZQ_CHEATS2]=temp_use_cheats; | |
| 19732 | |||
| 19733 | 478 | return 0; | |
| 19734 | 478 | } | |
| 19735 | |||
| 19736 | 298 | int32_t readinitdata_old(PACKFILE *f, zquestheader *Header, word s_version, zinitdata& temp_zinit) | |
| 19737 | { | ||
| 19738 |
2/2✓ Branch 0 taken 23 times.
✓ Branch 1 taken 275 times.
|
298 | bool should_skip = legacy_skip_flags && get_bit(legacy_skip_flags, skip_initdata); |
| 19739 | |||
| 19740 | byte padding, tempbyte; | ||
| 19741 | |||
| 19742 | // Legacy item properties (now integrated into itemdata) | ||
| 19743 | byte sword_hearts[4]; | ||
| 19744 | byte beam_hearts[4]; | ||
| 19745 | 298 | byte beam_percent=0; | |
| 19746 | word beam_power[4]; | ||
| 19747 | 298 | byte hookshot_length=99; | |
| 19748 | 298 | byte hookshot_links=100; | |
| 19749 | 298 | byte longshot_length=99; | |
| 19750 | 298 | byte longshot_links=100; | |
| 19751 | 298 | byte moving_fairy_hearts=3; | |
| 19752 | 298 | byte moving_fairy_heart_percent=0; | |
| 19753 | 298 | byte stationary_fairy_hearts=3; | |
| 19754 | 298 | byte stationary_fairy_heart_percent=0; | |
| 19755 | 298 | byte moving_fairy_magic=0; | |
| 19756 | 298 | byte moving_fairy_magic_percent=0; | |
| 19757 | 298 | byte stationary_fairy_magic=0; | |
| 19758 | 298 | byte stationary_fairy_magic_percent=0; | |
| 19759 | 298 | byte blue_potion_hearts=100; | |
| 19760 | 298 | byte blue_potion_heart_percent=1; | |
| 19761 | 298 | byte red_potion_hearts=100; | |
| 19762 | 298 | byte red_potion_heart_percent=1; | |
| 19763 | 298 | byte blue_potion_magic=100; | |
| 19764 | 298 | byte blue_potion_magic_percent=1; | |
| 19765 | 298 | byte red_potion_magic=100; | |
| 19766 | 298 | byte red_potion_magic_percent=1; | |
| 19767 | |||
| 19768 | 298 | byte bomb_ratio = 4; | |
| 19769 | |||
| 19770 | 298 | subscr_mode = 0; | |
| 19771 | |||
| 19772 | /* HIGHLY UNORTHODOX UPDATING THING, by L | ||
| 19773 | * This fixes quests made before revision 277 (such as the 'Lost Isle Build'), | ||
| 19774 | * where the speed of Pols Voice changed. It also coincided with V_INITDATA | ||
| 19775 | * changing from 13 to 14. | ||
| 19776 | */ | ||
| 19777 |
2/2✓ Branch 0 taken 216 times.
✓ Branch 1 taken 82 times.
|
298 | if(s_version < 14) |
| 19778 | 82 | fixpolsvoice=true; | |
| 19779 | |||
| 19780 | /* End highly unorthodox updating thing */ | ||
| 19781 | |||
| 19782 |
4/4✓ Branch 0 taken 216 times.
✓ Branch 1 taken 82 times.
✓ Branch 2 taken 106 times.
✓ Branch 3 taken 110 times.
|
298 | if(s_version >= 15 && get_bit(deprecated_rules, 27)) // The int16_t-lived rule, qr_JUMPHEROLAYER3 |
| 19783 | 110 | temp_zinit.jump_hero_layer_threshold=0; | |
| 19784 | |||
| 19785 |
2/2✓ Branch 0 taken 82 times.
✓ Branch 1 taken 216 times.
|
298 | if(s_version >= 10) |
| 19786 | { | ||
| 19787 | char temp; | ||
| 19788 | |||
| 19789 | //new-style items | ||
| 19790 |
2/2✓ Branch 0 taken 55296 times.
✓ Branch 1 taken 216 times.
|
55512 | for(int32_t j=0; j<256; j++) |
| 19791 | { | ||
| 19792 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 55296 times.
|
55296 | if(!p_getc(&temp,f)) |
| 19793 | ✗ | return qe_invalid; | |
| 19794 | |||
| 19795 | 55296 | temp_zinit.set_item(j, temp != 0); | |
| 19796 | 55296 | } | |
| 19797 | 216 | } | |
| 19798 | |||
| 19799 |
5/6✓ Branch 0 taken 23 times.
✓ Branch 1 taken 275 times.
✓ Branch 2 taken 5 times.
✓ Branch 3 taken 18 times.
✓ Branch 4 taken 5 times.
✗ Branch 5 not taken.
|
298 | if((Header->zelda_version > 0x192)||((Header->zelda_version == 0x192)&&(Header->build>26))) |
| 19800 | { | ||
| 19801 | char temp; | ||
| 19802 | |||
| 19803 | //finally... section data | ||
| 19804 |
4/4✓ Branch 0 taken 5 times.
✓ Branch 1 taken 275 times.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 4 times.
|
285 | if((Header->zelda_version > 0x192)|| |
| 19805 | //new only | ||
| 19806 |
1/2✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
|
5 | ((Header->zelda_version == 0x192)&&(Header->build>173))) |
| 19807 | { | ||
| 19808 | //OLD-style items... sigh | ||
| 19809 |
2/2✓ Branch 0 taken 216 times.
✓ Branch 1 taken 60 times.
|
276 | if(s_version < 10) |
| 19810 | { | ||
| 19811 |
1/2✓ Branch 0 taken 60 times.
✗ Branch 1 not taken.
|
60 | if(!p_getc(&temp,f)) |
| 19812 | { | ||
| 19813 | ✗ | return qe_invalid; | |
| 19814 | } | ||
| 19815 | |||
| 19816 | 60 | temp_zinit.set_item(iRaft, temp != 0); | |
| 19817 | |||
| 19818 |
1/2✓ Branch 0 taken 60 times.
✗ Branch 1 not taken.
|
60 | if(!p_getc(&temp,f)) |
| 19819 | { | ||
| 19820 | ✗ | return qe_invalid; | |
| 19821 | } | ||
| 19822 | |||
| 19823 | 60 | temp_zinit.set_item(iLadder, temp != 0); | |
| 19824 | |||
| 19825 |
1/2✓ Branch 0 taken 60 times.
✗ Branch 1 not taken.
|
60 | if(!p_getc(&temp,f)) |
| 19826 | { | ||
| 19827 | ✗ | return qe_invalid; | |
| 19828 | } | ||
| 19829 | |||
| 19830 | 60 | temp_zinit.set_item(iBook, temp != 0); | |
| 19831 | |||
| 19832 |
1/2✓ Branch 0 taken 60 times.
✗ Branch 1 not taken.
|
60 | if(!p_getc(&temp,f)) |
| 19833 | { | ||
| 19834 | ✗ | return qe_invalid; | |
| 19835 | } | ||
| 19836 | |||
| 19837 | 60 | temp_zinit.set_item(iMKey, temp != 0); | |
| 19838 | |||
| 19839 |
1/2✓ Branch 0 taken 60 times.
✗ Branch 1 not taken.
|
60 | if(!p_getc(&temp,f)) |
| 19840 | { | ||
| 19841 | ✗ | return qe_invalid; | |
| 19842 | } | ||
| 19843 | |||
| 19844 | 60 | temp_zinit.set_item(iFlippers, temp != 0); | |
| 19845 | |||
| 19846 |
1/2✓ Branch 0 taken 60 times.
✗ Branch 1 not taken.
|
60 | if(!p_getc(&temp,f)) |
| 19847 | { | ||
| 19848 | ✗ | return qe_invalid; | |
| 19849 | } | ||
| 19850 | |||
| 19851 | 60 | temp_zinit.set_item(iBoots, temp != 0); | |
| 19852 | 60 | } | |
| 19853 | 276 | } | |
| 19854 | |||
| 19855 |
2/2✓ Branch 0 taken 216 times.
✓ Branch 1 taken 64 times.
|
280 | if(s_version < 10) |
| 19856 | { | ||
| 19857 | char tempring, tempsword, tempshield, tempwallet, tempbracelet, tempamulet, tempbow; | ||
| 19858 | |||
| 19859 |
1/2✓ Branch 0 taken 64 times.
✗ Branch 1 not taken.
|
64 | if(!p_getc(&tempring,f)) |
| 19860 | { | ||
| 19861 | ✗ | return qe_invalid; | |
| 19862 | } | ||
| 19863 | |||
| 19864 |
1/2✓ Branch 0 taken 64 times.
✗ Branch 1 not taken.
|
64 | if(!p_getc(&tempsword,f)) |
| 19865 | { | ||
| 19866 | ✗ | return qe_invalid; | |
| 19867 | } | ||
| 19868 | |||
| 19869 |
1/2✓ Branch 0 taken 64 times.
✗ Branch 1 not taken.
|
64 | if(!p_getc(&tempshield,f)) |
| 19870 | { | ||
| 19871 | ✗ | return qe_invalid; | |
| 19872 | } | ||
| 19873 | |||
| 19874 |
1/2✓ Branch 0 taken 64 times.
✗ Branch 1 not taken.
|
64 | if(!p_getc(&tempwallet,f)) |
| 19875 | { | ||
| 19876 | ✗ | return qe_invalid; | |
| 19877 | } | ||
| 19878 | |||
| 19879 |
1/2✓ Branch 0 taken 64 times.
✗ Branch 1 not taken.
|
64 | if(!p_getc(&tempbracelet,f)) |
| 19880 | { | ||
| 19881 | ✗ | return qe_invalid; | |
| 19882 | } | ||
| 19883 | |||
| 19884 |
1/2✓ Branch 0 taken 64 times.
✗ Branch 1 not taken.
|
64 | if(!p_getc(&tempamulet,f)) |
| 19885 | { | ||
| 19886 | ✗ | return qe_invalid; | |
| 19887 | } | ||
| 19888 | |||
| 19889 |
1/2✓ Branch 0 taken 64 times.
✗ Branch 1 not taken.
|
64 | if(!p_getc(&tempbow,f)) |
| 19890 | { | ||
| 19891 | ✗ | return qe_invalid; | |
| 19892 | } | ||
| 19893 | |||
| 19894 | //old only | ||
| 19895 |
4/4✓ Branch 0 taken 5 times.
✓ Branch 1 taken 59 times.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 4 times.
|
64 | if((Header->zelda_version == 0x192)&&(Header->build<174)) |
| 19896 | { | ||
| 19897 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
|
4 | tempring=(tempring)?(1<<(tempring-1)):0; |
| 19898 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
|
4 | tempsword=(tempsword)?(1<<(tempsword-1)):0; |
| 19899 |
1/2✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
|
4 | tempshield=(tempshield)?(1<<(tempshield-1)):0; |
| 19900 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
|
4 | tempwallet=(tempwallet)?(1<<(tempwallet-1)):0; |
| 19901 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
|
4 | tempbracelet=(tempbracelet)?(1<<(tempbracelet-1)):0; |
| 19902 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
|
4 | tempamulet=(tempamulet)?(1<<(tempamulet-1)):0; |
| 19903 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
|
4 | tempbow=(tempbow)?(1<<(tempbow-1)):0; |
| 19904 | 4 | } | |
| 19905 | |||
| 19906 | //rings start at level 2... wtf | ||
| 19907 | //account for this -DD | ||
| 19908 | 64 | tempring <<= 1; | |
| 19909 | 64 | addOldStyleFamily(&temp_zinit, itemsbuf, itype_ring, tempring); | |
| 19910 | 64 | addOldStyleFamily(&temp_zinit, itemsbuf, itype_sword, tempsword); | |
| 19911 | 64 | addOldStyleFamily(&temp_zinit, itemsbuf, itype_shield, tempshield); | |
| 19912 | 64 | addOldStyleFamily(&temp_zinit, itemsbuf, itype_wallet, tempwallet); | |
| 19913 | //bracelet ALSO starts at level 2 :-( -DD | ||
| 19914 | 64 | tempbracelet<<=1; | |
| 19915 | 64 | addOldStyleFamily(&temp_zinit, itemsbuf, itype_bracelet, tempbracelet); | |
| 19916 | 64 | addOldStyleFamily(&temp_zinit, itemsbuf, itype_amulet, tempamulet); | |
| 19917 | 64 | addOldStyleFamily(&temp_zinit, itemsbuf, itype_bow, tempbow); | |
| 19918 | |||
| 19919 | //new only | ||
| 19920 |
4/4✓ Branch 0 taken 5 times.
✓ Branch 1 taken 59 times.
✓ Branch 2 taken 4 times.
✓ Branch 3 taken 1 times.
|
64 | if((Header->zelda_version == 0x192)&&(Header->build>173)) |
| 19921 | { | ||
| 19922 |
2/2✓ Branch 0 taken 32 times.
✓ Branch 1 taken 1 times.
|
33 | for(int32_t q=0; q<32; q++) |
| 19923 | { | ||
| 19924 |
1/2✓ Branch 0 taken 32 times.
✗ Branch 1 not taken.
|
32 | if(!p_getc(&padding,f)) |
| 19925 | { | ||
| 19926 | ✗ | return qe_invalid; | |
| 19927 | } | ||
| 19928 | 32 | } | |
| 19929 | 1 | } | |
| 19930 | |||
| 19931 | char tempcandle, tempboomerang, temparrow, tempwhistle; | ||
| 19932 | |||
| 19933 |
1/2✓ Branch 0 taken 64 times.
✗ Branch 1 not taken.
|
64 | if(!p_getc(&tempcandle,f)) |
| 19934 | { | ||
| 19935 | ✗ | return qe_invalid; | |
| 19936 | } | ||
| 19937 | |||
| 19938 |
1/2✓ Branch 0 taken 64 times.
✗ Branch 1 not taken.
|
64 | if(!p_getc(&tempboomerang,f)) |
| 19939 | { | ||
| 19940 | ✗ | return qe_invalid; | |
| 19941 | } | ||
| 19942 | |||
| 19943 |
1/2✓ Branch 0 taken 64 times.
✗ Branch 1 not taken.
|
64 | if(!p_getc(&temparrow,f)) |
| 19944 | { | ||
| 19945 | ✗ | return qe_invalid; | |
| 19946 | } | ||
| 19947 | |||
| 19948 |
1/2✓ Branch 0 taken 64 times.
✗ Branch 1 not taken.
|
64 | if(!p_getc(&temp,f)) |
| 19949 | { | ||
| 19950 | ✗ | return qe_invalid; | |
| 19951 | } | ||
| 19952 | |||
| 19953 | 64 | addOldStyleFamily(&temp_zinit, itemsbuf, itype_potion, temp); | |
| 19954 | |||
| 19955 |
1/2✓ Branch 0 taken 64 times.
✗ Branch 1 not taken.
|
64 | if(!p_getc(&tempwhistle,f)) |
| 19956 | { | ||
| 19957 | ✗ | return qe_invalid; | |
| 19958 | } | ||
| 19959 | |||
| 19960 | //old only | ||
| 19961 |
4/4✓ Branch 0 taken 5 times.
✓ Branch 1 taken 59 times.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 4 times.
|
64 | if((Header->zelda_version == 0x192)&&(Header->build<174)) |
| 19962 | { | ||
| 19963 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
|
4 | tempcandle=(tempcandle)?(1<<(tempcandle-1)):0; |
| 19964 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
|
4 | tempboomerang=(tempboomerang)?(1<<(tempboomerang-1)):0; |
| 19965 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
|
4 | temparrow=(temparrow)?(1<<(temparrow-1)):0; |
| 19966 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
|
4 | tempwhistle=(tempwhistle)?(1<<(tempwhistle-1)):0; |
| 19967 | 4 | } | |
| 19968 | |||
| 19969 | 64 | addOldStyleFamily(&temp_zinit, itemsbuf, itype_candle, tempcandle); | |
| 19970 | 64 | addOldStyleFamily(&temp_zinit, itemsbuf, itype_brang, tempboomerang); | |
| 19971 | 64 | addOldStyleFamily(&temp_zinit, itemsbuf, itype_arrow, temparrow); | |
| 19972 | 64 | addOldStyleFamily(&temp_zinit, itemsbuf, itype_whistle, tempwhistle); | |
| 19973 | //What about the potion...? | ||
| 19974 | |||
| 19975 | 64 | } | |
| 19976 | |||
| 19977 |
2/2✓ Branch 0 taken 16 times.
✓ Branch 1 taken 264 times.
|
280 | if(s_version < 29) |
| 19978 | { | ||
| 19979 | //Oh sure, stick these IN THE MIDDLE OF THE ITEMS, just to make me want | ||
| 19980 | //to jab out my eye... | ||
| 19981 |
1/2✓ Branch 0 taken 264 times.
✗ Branch 1 not taken.
|
264 | if(!p_getc(&padding,f)) |
| 19982 | ✗ | return qe_invalid; | |
| 19983 | 264 | temp_zinit.counter[crBOMBS] = padding; | |
| 19984 | |||
| 19985 |
1/2✓ Branch 0 taken 264 times.
✗ Branch 1 not taken.
|
264 | if(!p_getc(&padding,f)) |
| 19986 | ✗ | return qe_invalid; | |
| 19987 | 264 | temp_zinit.counter[crSBOMBS] = padding; | |
| 19988 | 264 | } | |
| 19989 | |||
| 19990 | //Back to more OLD item code | ||
| 19991 |
2/2✓ Branch 0 taken 216 times.
✓ Branch 1 taken 64 times.
|
280 | if(s_version < 10) |
| 19992 | { | ||
| 19993 |
4/4✓ Branch 0 taken 5 times.
✓ Branch 1 taken 59 times.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 4 times.
|
69 | if((Header->zelda_version > 0x192)|| |
| 19994 | //new only | ||
| 19995 |
1/2✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
|
5 | ((Header->zelda_version == 0x192)&&(Header->build>173))) |
| 19996 | { | ||
| 19997 |
1/2✓ Branch 0 taken 60 times.
✗ Branch 1 not taken.
|
60 | if(!p_getc(&temp,f)) |
| 19998 | { | ||
| 19999 | ✗ | return qe_invalid; | |
| 20000 | } | ||
| 20001 | |||
| 20002 | 60 | addOldStyleFamily(&temp_zinit, itemsbuf, itype_wand, temp); | |
| 20003 | |||
| 20004 |
1/2✓ Branch 0 taken 60 times.
✗ Branch 1 not taken.
|
60 | if(!p_getc(&temp,f)) |
| 20005 | { | ||
| 20006 | ✗ | return qe_invalid; | |
| 20007 | } | ||
| 20008 | |||
| 20009 | 60 | addOldStyleFamily(&temp_zinit, itemsbuf, itype_letter, temp); | |
| 20010 | |||
| 20011 |
1/2✓ Branch 0 taken 60 times.
✗ Branch 1 not taken.
|
60 | if(!p_getc(&temp,f)) |
| 20012 | { | ||
| 20013 | ✗ | return qe_invalid; | |
| 20014 | } | ||
| 20015 | |||
| 20016 | 60 | addOldStyleFamily(&temp_zinit, itemsbuf, itype_lens, temp); | |
| 20017 | |||
| 20018 |
1/2✓ Branch 0 taken 60 times.
✗ Branch 1 not taken.
|
60 | if(!p_getc(&temp,f)) |
| 20019 | { | ||
| 20020 | ✗ | return qe_invalid; | |
| 20021 | } | ||
| 20022 | |||
| 20023 | 60 | addOldStyleFamily(&temp_zinit, itemsbuf, itype_hookshot, temp); | |
| 20024 | |||
| 20025 |
1/2✓ Branch 0 taken 60 times.
✗ Branch 1 not taken.
|
60 | if(!p_getc(&temp,f)) |
| 20026 | { | ||
| 20027 | ✗ | return qe_invalid; | |
| 20028 | } | ||
| 20029 | |||
| 20030 | 60 | addOldStyleFamily(&temp_zinit, itemsbuf, itype_bait, temp); | |
| 20031 | |||
| 20032 |
1/2✓ Branch 0 taken 60 times.
✗ Branch 1 not taken.
|
60 | if(!p_getc(&temp,f)) |
| 20033 | { | ||
| 20034 | ✗ | return qe_invalid; | |
| 20035 | } | ||
| 20036 | |||
| 20037 | 60 | addOldStyleFamily(&temp_zinit, itemsbuf, itype_hammer, temp); | |
| 20038 | |||
| 20039 |
1/2✓ Branch 0 taken 60 times.
✗ Branch 1 not taken.
|
60 | if(!p_getc(&temp,f)) |
| 20040 | { | ||
| 20041 | ✗ | return qe_invalid; | |
| 20042 | } | ||
| 20043 | |||
| 20044 | 60 | addOldStyleFamily(&temp_zinit, itemsbuf, itype_divinefire, temp); | |
| 20045 | |||
| 20046 |
1/2✓ Branch 0 taken 60 times.
✗ Branch 1 not taken.
|
60 | if(!p_getc(&temp,f)) |
| 20047 | { | ||
| 20048 | ✗ | return qe_invalid; | |
| 20049 | } | ||
| 20050 | |||
| 20051 | 60 | addOldStyleFamily(&temp_zinit, itemsbuf, itype_divineescape, temp); | |
| 20052 | |||
| 20053 |
1/2✓ Branch 0 taken 60 times.
✗ Branch 1 not taken.
|
60 | if(!p_getc(&temp,f)) |
| 20054 | { | ||
| 20055 | ✗ | return qe_invalid; | |
| 20056 | } | ||
| 20057 | |||
| 20058 | 60 | addOldStyleFamily(&temp_zinit, itemsbuf, itype_divineprotection, temp); | |
| 20059 | |||
| 20060 |
1/2✓ Branch 0 taken 60 times.
✗ Branch 1 not taken.
|
60 | if(!p_getc(&temp,f)) |
| 20061 | { | ||
| 20062 | ✗ | return qe_invalid; | |
| 20063 | } | ||
| 20064 | |||
| 20065 |
2/2✓ Branch 0 taken 59 times.
✓ Branch 1 taken 1 times.
|
60 | if(Header->zelda_version == 0x192) |
| 20066 | { | ||
| 20067 |
2/2✓ Branch 0 taken 32 times.
✓ Branch 1 taken 1 times.
|
33 | for(int32_t q=0; q<32; q++) |
| 20068 | { | ||
| 20069 |
1/2✓ Branch 0 taken 32 times.
✗ Branch 1 not taken.
|
32 | if(!p_getc(&padding,f)) |
| 20070 | { | ||
| 20071 | ✗ | return qe_invalid; | |
| 20072 | } | ||
| 20073 | 32 | } | |
| 20074 | 1 | } | |
| 20075 | 60 | } | |
| 20076 | 64 | } | |
| 20077 | |||
| 20078 | //old only | ||
| 20079 |
4/4✓ Branch 0 taken 5 times.
✓ Branch 1 taken 275 times.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 4 times.
|
280 | if((Header->zelda_version == 0x192)&&(Header->build<174)) |
| 20080 | { | ||
| 20081 | byte equipment, tmpitm; //bit flags | ||
| 20082 | |||
| 20083 |
1/2✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
|
4 | if(!p_getc(&equipment,f)) |
| 20084 | { | ||
| 20085 | ✗ | return qe_invalid; | |
| 20086 | } | ||
| 20087 | |||
| 20088 | 4 | temp_zinit.set_item(iRaft, get_bit(&equipment, idE_RAFT)!=0); | |
| 20089 | 4 | temp_zinit.set_item(iLadder, get_bit(&equipment, idE_LADDER)!=0); | |
| 20090 | 4 | temp_zinit.set_item(iBook, get_bit(&equipment, idE_BOOK)!=0); | |
| 20091 | 4 | temp_zinit.set_item(iMKey, get_bit(&equipment, idE_KEY)!=0); | |
| 20092 | 4 | temp_zinit.set_item(iFlippers, get_bit(&equipment, idE_FLIPPERS)!=0); | |
| 20093 | 4 | temp_zinit.set_item(iBoots, get_bit(&equipment, idE_BOOTS)!=0); | |
| 20094 | |||
| 20095 | |||
| 20096 |
1/2✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
|
4 | if(!p_getc(&tmpitm,f)) |
| 20097 | { | ||
| 20098 | ✗ | return qe_invalid; | |
| 20099 | } | ||
| 20100 | |||
| 20101 | 4 | temp_zinit.set_item(iWand, get_bit(&tmpitm, idI_WAND)!=0); | |
| 20102 | 4 | temp_zinit.set_item(iLetter, get_bit(&tmpitm, idI_LETTER)!=0); | |
| 20103 | 4 | temp_zinit.set_item(iLens, get_bit(&tmpitm, idI_LENS)!=0); | |
| 20104 | 4 | temp_zinit.set_item(iHookshot, get_bit(&tmpitm, idI_HOOKSHOT)!=0); | |
| 20105 | 4 | temp_zinit.set_item(iBait, get_bit(&tmpitm, idI_BAIT)!=0); | |
| 20106 | 4 | temp_zinit.set_item(iHammer, get_bit(&tmpitm, idI_HAMMER)!=0); | |
| 20107 | 4 | } | |
| 20108 | |||
| 20109 |
1/2✓ Branch 0 taken 280 times.
✗ Branch 1 not taken.
|
280 | if(!p_getc(&tempbyte,f)) |
| 20110 | ✗ | return qe_invalid; | |
| 20111 | 280 | temp_zinit.mcounter[crLIFE] = tempbyte; | |
| 20112 | |||
| 20113 | |||
| 20114 |
2/2✓ Branch 0 taken 64 times.
✓ Branch 1 taken 216 times.
|
280 | if(s_version < 14) |
| 20115 | { | ||
| 20116 | byte temphp; | ||
| 20117 | |||
| 20118 |
1/2✓ Branch 0 taken 64 times.
✗ Branch 1 not taken.
|
64 | if(!p_getc(&temphp,f)) |
| 20119 | { | ||
| 20120 | ✗ | return qe_invalid; | |
| 20121 | } | ||
| 20122 | |||
| 20123 | 64 | temp_zinit.counter[crLIFE]=temphp; | |
| 20124 | |||
| 20125 |
1/2✓ Branch 0 taken 64 times.
✗ Branch 1 not taken.
|
64 | if(!p_getc(&temphp,f)) |
| 20126 | { | ||
| 20127 | ✗ | return qe_invalid; | |
| 20128 | } | ||
| 20129 | |||
| 20130 | 64 | temp_zinit.cont_heart=temphp; | |
| 20131 | 64 | } | |
| 20132 | else | ||
| 20133 | { | ||
| 20134 |
1/2✓ Branch 0 taken 216 times.
✗ Branch 1 not taken.
|
216 | if(!p_igetw(&temp_zinit.counter[crLIFE],f)) |
| 20135 | { | ||
| 20136 | ✗ | return qe_invalid; | |
| 20137 | } | ||
| 20138 | |||
| 20139 |
1/2✓ Branch 0 taken 216 times.
✗ Branch 1 not taken.
|
216 | if(!p_igetw(&temp_zinit.cont_heart,f)) |
| 20140 | { | ||
| 20141 | ✗ | return qe_invalid; | |
| 20142 | } | ||
| 20143 | } | ||
| 20144 | |||
| 20145 |
1/2✓ Branch 0 taken 280 times.
✗ Branch 1 not taken.
|
280 | if(!p_getc(&temp_zinit.hcp,f)) |
| 20146 | { | ||
| 20147 | ✗ | return qe_invalid; | |
| 20148 | } | ||
| 20149 | |||
| 20150 |
2/2✓ Branch 0 taken 64 times.
✓ Branch 1 taken 216 times.
|
280 | if(s_version >= 14) |
| 20151 | { | ||
| 20152 |
1/2✓ Branch 0 taken 216 times.
✗ Branch 1 not taken.
|
216 | if(!p_getc(&temp_zinit.hcp_per_hc,f)) |
| 20153 | { | ||
| 20154 | ✗ | return qe_invalid; | |
| 20155 | } | ||
| 20156 | |||
| 20157 |
1/2✓ Branch 0 taken 216 times.
✗ Branch 1 not taken.
|
216 | if(s_version<16) // July 2007 |
| 20158 | { | ||
| 20159 | ✗ | if(get_qr(qr_BRANGPICKUP+1)) | |
| 20160 | ✗ | temp_zinit.hcp_per_hc = 0xFF; | |
| 20161 | |||
| 20162 | //Dispose of legacy rule | ||
| 20163 | ✗ | set_qr(qr_BRANGPICKUP+1, 0); | |
| 20164 | ✗ | } | |
| 20165 | 216 | } | |
| 20166 | |||
| 20167 |
2/2✓ Branch 0 taken 16 times.
✓ Branch 1 taken 264 times.
|
280 | if(s_version < 29) |
| 20168 | { | ||
| 20169 |
1/2✓ Branch 0 taken 264 times.
✗ Branch 1 not taken.
|
264 | if(!p_getc(&padding,f)) |
| 20170 | ✗ | return qe_invalid; | |
| 20171 | 264 | temp_zinit.mcounter[crBOMBS] = padding; | |
| 20172 | 264 | } | |
| 20173 | |||
| 20174 |
1/2✓ Branch 0 taken 280 times.
✗ Branch 1 not taken.
|
280 | if(!p_getc(&temp_zinit.counter[crKEYS],f)) |
| 20175 | { | ||
| 20176 | ✗ | return qe_invalid; | |
| 20177 | } | ||
| 20178 | |||
| 20179 |
1/2✓ Branch 0 taken 280 times.
✗ Branch 1 not taken.
|
280 | if(!p_igetw(&temp_zinit.counter[crMONEY],f)) |
| 20180 | { | ||
| 20181 | ✗ | return qe_invalid; | |
| 20182 | } | ||
| 20183 | |||
| 20184 |
1/2✓ Branch 0 taken 280 times.
✗ Branch 1 not taken.
|
280 | if(!p_getc(&tempbyte,f)) |
| 20185 | ✗ | return qe_invalid; | |
| 20186 |
2/2✓ Branch 0 taken 2240 times.
✓ Branch 1 taken 280 times.
|
2520 | for(int q = 0; q < 8; ++q) |
| 20187 |
2/2✓ Branch 0 taken 504 times.
✓ Branch 1 taken 1736 times.
|
2240 | SETFLAG(temp_zinit.litems[q+1], liTRIFORCE, get_bitl(tempbyte, q)); |
| 20188 | |||
| 20189 | 280 | int level_count = 32; | |
| 20190 |
3/6✓ Branch 0 taken 64 times.
✓ Branch 1 taken 216 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 64 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
280 | if(s_version>12 || (Header->zelda_version == 0x211 && Header->build == 18)) |
| 20191 | 216 | level_count = 64; | |
| 20192 | byte tmp_map[64]; | ||
| 20193 | byte tmp_compass[64]; | ||
| 20194 |
2/2✓ Branch 0 taken 15872 times.
✓ Branch 1 taken 280 times.
|
16152 | for(int32_t i=0; i<level_count; i++) |
| 20195 |
1/2✓ Branch 0 taken 15872 times.
✗ Branch 1 not taken.
|
15872 | if(!p_getc(&tmp_map[i],f)) |
| 20196 | ✗ | return qe_invalid; | |
| 20197 |
2/2✓ Branch 0 taken 15872 times.
✓ Branch 1 taken 280 times.
|
16152 | for(int32_t i=0; i<level_count; i++) |
| 20198 |
1/2✓ Branch 0 taken 15872 times.
✗ Branch 1 not taken.
|
15872 | if(!p_getc(&tmp_compass[i],f)) |
| 20199 | ✗ | return qe_invalid; | |
| 20200 |
2/2✓ Branch 0 taken 126976 times.
✓ Branch 1 taken 280 times.
|
127256 | for(int q = 0; q < level_count*8; ++q) |
| 20201 | { | ||
| 20202 |
2/2✓ Branch 0 taken 796 times.
✓ Branch 1 taken 126180 times.
|
126976 | SETFLAG(temp_zinit.litems[q], liMAP, get_bit(tmp_map, q)); |
| 20203 |
2/2✓ Branch 0 taken 6 times.
✓ Branch 1 taken 126970 times.
|
126976 | SETFLAG(temp_zinit.litems[q], liCOMPASS, get_bit(tmp_compass, q)); |
| 20204 | 126976 | } | |
| 20205 | |||
| 20206 |
4/4✓ Branch 0 taken 5 times.
✓ Branch 1 taken 275 times.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 4 times.
|
285 | if((Header->zelda_version > 0x192)|| |
| 20207 | //new only | ||
| 20208 |
1/2✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
|
5 | ((Header->zelda_version == 0x192)&&(Header->build>173))) |
| 20209 | { | ||
| 20210 | byte tmp_boss_key[64]; | ||
| 20211 |
2/2✓ Branch 0 taken 15744 times.
✓ Branch 1 taken 276 times.
|
16020 | for(int32_t i=0; i<level_count; i++) |
| 20212 | { | ||
| 20213 |
1/2✓ Branch 0 taken 15744 times.
✗ Branch 1 not taken.
|
15744 | if(!p_getc(&tmp_boss_key[i],f)) |
| 20214 | { | ||
| 20215 | ✗ | return qe_invalid; | |
| 20216 | } | ||
| 20217 | 15744 | } | |
| 20218 |
2/2✓ Branch 0 taken 125952 times.
✓ Branch 1 taken 276 times.
|
126228 | for(int q = 0; q < level_count*8; ++q) |
| 20219 | { | ||
| 20220 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 125952 times.
|
125952 | SETFLAG(temp_zinit.litems[q], liBOSSKEY, get_bit(tmp_boss_key, q)); |
| 20221 | 125952 | } | |
| 20222 | 276 | } | |
| 20223 | |||
| 20224 | byte tmpmisc[16]; | ||
| 20225 |
2/2✓ Branch 0 taken 4480 times.
✓ Branch 1 taken 280 times.
|
4760 | for(int32_t i=0; i<16; i++) |
| 20226 |
1/2✓ Branch 0 taken 4480 times.
✗ Branch 1 not taken.
|
4480 | if(!p_getc(&tmpmisc[i],f)) |
| 20227 | ✗ | return qe_invalid; | |
| 20228 | 280 | temp_zinit.flags.set(INIT_FL_CONTPERCENT,get_bit(tmpmisc,0)); | |
| 20229 | 280 | temp_zinit.magicdrainrate = get_bit(tmpmisc,1) ? 1 : 2; //Double Magic flag | |
| 20230 | 280 | temp_zinit.flags.set(INIT_FL_CANSLASH,get_bit(tmpmisc,2)); | |
| 20231 | |||
| 20232 |
4/4✓ Branch 0 taken 216 times.
✓ Branch 1 taken 64 times.
✓ Branch 2 taken 256 times.
✓ Branch 3 taken 64 times.
|
536 | if(s_version < 15) for(int32_t i=0; i<4; i++) |
| 20233 |
1/2✓ Branch 0 taken 256 times.
✗ Branch 1 not taken.
|
256 | if(!p_getc(&sword_hearts[i],f)) |
| 20234 | 64 | return qe_invalid; | |
| 20235 | |||
| 20236 |
1/2✓ Branch 0 taken 280 times.
✗ Branch 1 not taken.
|
280 | if(!p_getc(&temp_zinit.last_map,f)) |
| 20237 | { | ||
| 20238 | ✗ | return qe_invalid; | |
| 20239 | } | ||
| 20240 | |||
| 20241 |
1/2✓ Branch 0 taken 280 times.
✗ Branch 1 not taken.
|
280 | if(!p_getc(&temp_zinit.last_screen,f)) |
| 20242 | { | ||
| 20243 | ✗ | return qe_invalid; | |
| 20244 | } | ||
| 20245 | |||
| 20246 |
2/2✓ Branch 0 taken 64 times.
✓ Branch 1 taken 216 times.
|
280 | if(s_version < 14) |
| 20247 | { | ||
| 20248 | byte tempmp; | ||
| 20249 | |||
| 20250 |
1/2✓ Branch 0 taken 64 times.
✗ Branch 1 not taken.
|
64 | if(!p_getc(&tempmp,f)) |
| 20251 | { | ||
| 20252 | ✗ | return qe_invalid; | |
| 20253 | } | ||
| 20254 | |||
| 20255 | 64 | temp_zinit.mcounter[crMAGIC]=tempmp; | |
| 20256 | |||
| 20257 |
1/2✓ Branch 0 taken 64 times.
✗ Branch 1 not taken.
|
64 | if(!p_getc(&tempmp,f)) |
| 20258 | { | ||
| 20259 | ✗ | return qe_invalid; | |
| 20260 | } | ||
| 20261 | |||
| 20262 | 64 | temp_zinit.counter[crMAGIC]=tempmp; | |
| 20263 | 64 | } | |
| 20264 | else | ||
| 20265 | { | ||
| 20266 |
1/2✓ Branch 0 taken 216 times.
✗ Branch 1 not taken.
|
216 | if(!p_igetw(&temp_zinit.mcounter[crMAGIC],f)) |
| 20267 | { | ||
| 20268 | ✗ | return qe_invalid; | |
| 20269 | } | ||
| 20270 | |||
| 20271 |
1/2✓ Branch 0 taken 216 times.
✗ Branch 1 not taken.
|
216 | if(!p_igetw(&temp_zinit.counter[crMAGIC],f)) |
| 20272 | { | ||
| 20273 | ✗ | return qe_invalid; | |
| 20274 | } | ||
| 20275 | } | ||
| 20276 | |||
| 20277 | |||
| 20278 |
2/2✓ Branch 0 taken 64 times.
✓ Branch 1 taken 216 times.
|
280 | if(s_version < 15) |
| 20279 | { | ||
| 20280 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 64 times.
|
64 | if(s_version < 12) |
| 20281 | { | ||
| 20282 | 64 | temp_zinit.mcounter[crMAGIC]*=32; | |
| 20283 | 64 | temp_zinit.counter[crMAGIC]*=32; | |
| 20284 | 64 | } | |
| 20285 | |||
| 20286 |
2/2✓ Branch 0 taken 256 times.
✓ Branch 1 taken 64 times.
|
320 | for(int32_t i=0; i<4; i++) |
| 20287 | { | ||
| 20288 |
1/2✓ Branch 0 taken 256 times.
✗ Branch 1 not taken.
|
256 | if(!p_getc(&beam_hearts[i],f)) |
| 20289 | { | ||
| 20290 | ✗ | return qe_invalid; | |
| 20291 | } | ||
| 20292 | 256 | } | |
| 20293 | |||
| 20294 |
1/2✓ Branch 0 taken 64 times.
✗ Branch 1 not taken.
|
64 | if(!p_getc(&beam_percent,f)) |
| 20295 | { | ||
| 20296 | ✗ | return qe_invalid; | |
| 20297 | } | ||
| 20298 | 64 | } | |
| 20299 | else | ||
| 20300 | { | ||
| 20301 |
1/2✓ Branch 0 taken 216 times.
✗ Branch 1 not taken.
|
216 | if(!p_getc(&temp_zinit.bomb_ratio,f)) |
| 20302 | ✗ | return qe_invalid; | |
| 20303 |
1/2✓ Branch 0 taken 216 times.
✗ Branch 1 not taken.
|
216 | if(temp_zinit.bomb_ratio < 1) |
| 20304 | ✗ | temp_zinit.bomb_ratio = 1; | |
| 20305 | 216 | else bomb_ratio = temp_zinit.bomb_ratio; //jank | |
| 20306 | } | ||
| 20307 | |||
| 20308 |
2/2✓ Branch 0 taken 216 times.
✓ Branch 1 taken 64 times.
|
280 | if(s_version < 15) |
| 20309 | { | ||
| 20310 | byte tempbp; | ||
| 20311 | |||
| 20312 |
2/2✓ Branch 0 taken 256 times.
✓ Branch 1 taken 64 times.
|
320 | for(int32_t i=0; i<4; i++) |
| 20313 | { | ||
| 20314 |
2/4✓ Branch 0 taken 256 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 256 times.
✗ Branch 3 not taken.
|
256 | if(!(s_version < 14 ? p_getc(&tempbp,f) : p_igetw(&tempbp,f))) |
| 20315 | { | ||
| 20316 | ✗ | return qe_invalid; | |
| 20317 | } | ||
| 20318 | |||
| 20319 | 256 | beam_power[i]=tempbp; | |
| 20320 | 256 | } | |
| 20321 | |||
| 20322 |
1/2✓ Branch 0 taken 64 times.
✗ Branch 1 not taken.
|
64 | if(!p_getc(&hookshot_links,f)) |
| 20323 | { | ||
| 20324 | ✗ | return qe_invalid; | |
| 20325 | } | ||
| 20326 | |||
| 20327 |
1/2✓ Branch 0 taken 64 times.
✗ Branch 1 not taken.
|
64 | if(s_version>6) |
| 20328 | { | ||
| 20329 | ✗ | if(!p_getc(&hookshot_length,f)) | |
| 20330 | { | ||
| 20331 | ✗ | return qe_invalid; | |
| 20332 | } | ||
| 20333 | |||
| 20334 | ✗ | if(!p_getc(&longshot_links,f)) | |
| 20335 | { | ||
| 20336 | ✗ | return qe_invalid; | |
| 20337 | } | ||
| 20338 | |||
| 20339 | ✗ | if(!p_getc(&longshot_length,f)) | |
| 20340 | { | ||
| 20341 | ✗ | return qe_invalid; | |
| 20342 | } | ||
| 20343 | ✗ | } | |
| 20344 | 64 | } | |
| 20345 | |||
| 20346 |
1/2✓ Branch 0 taken 280 times.
✗ Branch 1 not taken.
|
280 | if(!p_getc(&temp_zinit.msg_more_x,f)) |
| 20347 | { | ||
| 20348 | ✗ | return qe_invalid; | |
| 20349 | } | ||
| 20350 | |||
| 20351 |
1/2✓ Branch 0 taken 280 times.
✗ Branch 1 not taken.
|
280 | if(!p_getc(&temp_zinit.msg_more_y,f)) |
| 20352 | { | ||
| 20353 | ✗ | return qe_invalid; | |
| 20354 | } | ||
| 20355 | |||
| 20356 |
1/2✓ Branch 0 taken 280 times.
✗ Branch 1 not taken.
|
280 | if(!p_getc(&subscr_mode,f)) |
| 20357 | ✗ | return qe_invalid; | |
| 20358 | |||
| 20359 | //old only | ||
| 20360 |
4/4✓ Branch 0 taken 5 times.
✓ Branch 1 taken 275 times.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 4 times.
|
280 | if((Header->zelda_version == 0x192)&&(Header->build<174)) |
| 20361 | { | ||
| 20362 | byte tmp_boss_key[32]; | ||
| 20363 |
2/2✓ Branch 0 taken 128 times.
✓ Branch 1 taken 4 times.
|
132 | for(int32_t i=0; i<32; i++) |
| 20364 | { | ||
| 20365 |
1/2✓ Branch 0 taken 128 times.
✗ Branch 1 not taken.
|
128 | if(!p_getc(&tmp_boss_key[i],f)) |
| 20366 | { | ||
| 20367 | ✗ | return qe_invalid; | |
| 20368 | } | ||
| 20369 | 128 | } | |
| 20370 |
2/2✓ Branch 0 taken 1024 times.
✓ Branch 1 taken 4 times.
|
1028 | for(int q = 0; q < 32*8; ++q) |
| 20371 | { | ||
| 20372 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1024 times.
|
1024 | SETFLAG(temp_zinit.litems[q], liBOSSKEY, get_bit(tmp_boss_key, q)); |
| 20373 | 1024 | } | |
| 20374 | 4 | } | |
| 20375 | |||
| 20376 |
5/6✓ Branch 0 taken 5 times.
✓ Branch 1 taken 275 times.
✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✓ Branch 5 taken 4 times.
|
280 | if((Header->zelda_version > 0x192)||((Header->zelda_version == 0x192)&&(Header->build>173))) //new only |
| 20377 | { | ||
| 20378 |
2/2✓ Branch 0 taken 60 times.
✓ Branch 1 taken 216 times.
|
276 | if(s_version <= 10) |
| 20379 | { | ||
| 20380 |
1/2✓ Branch 0 taken 60 times.
✗ Branch 1 not taken.
|
60 | if(!p_getc(&tempbyte,f)) |
| 20381 | { | ||
| 20382 | ✗ | return qe_invalid; | |
| 20383 | } | ||
| 20384 | |||
| 20385 | 60 | temp_zinit.start_dmap = (word)tempbyte; | |
| 20386 | 60 | } | |
| 20387 | else | ||
| 20388 | { | ||
| 20389 |
1/2✓ Branch 0 taken 216 times.
✗ Branch 1 not taken.
|
216 | if(!p_igetw(&temp_zinit.start_dmap,f)) |
| 20390 | { | ||
| 20391 | ✗ | return qe_invalid; | |
| 20392 | } | ||
| 20393 | } | ||
| 20394 | |||
| 20395 |
1/2✓ Branch 0 taken 276 times.
✗ Branch 1 not taken.
|
276 | if(!p_getc(&temp_zinit.heroAnimationStyle,f)) |
| 20396 | { | ||
| 20397 | ✗ | return qe_invalid; | |
| 20398 | } | ||
| 20399 | 276 | } | |
| 20400 | |||
| 20401 |
4/4✓ Branch 0 taken 216 times.
✓ Branch 1 taken 64 times.
✓ Branch 2 taken 16 times.
✓ Branch 3 taken 200 times.
|
280 | if(s_version>1 && s_version < 29) |
| 20402 | { | ||
| 20403 |
1/2✓ Branch 0 taken 200 times.
✗ Branch 1 not taken.
|
200 | if(!p_getc(&padding,f)) |
| 20404 | ✗ | return qe_invalid; | |
| 20405 | 200 | temp_zinit.counter[crARROWS] = padding; | |
| 20406 | |||
| 20407 |
1/2✓ Branch 0 taken 200 times.
✗ Branch 1 not taken.
|
200 | if(!p_getc(&padding,f)) |
| 20408 | ✗ | return qe_invalid; | |
| 20409 | 200 | temp_zinit.mcounter[crARROWS] = padding; | |
| 20410 | 200 | } | |
| 20411 | |||
| 20412 |
2/2✓ Branch 0 taken 64 times.
✓ Branch 1 taken 216 times.
|
280 | if(s_version>2) |
| 20413 | { | ||
| 20414 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 216 times.
|
216 | if(s_version <= 10) |
| 20415 | { | ||
| 20416 | ✗ | for(int32_t i=0; i<OLDMAXLEVELS; i++) | |
| 20417 | { | ||
| 20418 | ✗ | if(!p_getc(&(temp_zinit.level_keys[i]),f)) | |
| 20419 | { | ||
| 20420 | ✗ | return qe_invalid; | |
| 20421 | } | ||
| 20422 | ✗ | } | |
| 20423 | ✗ | } | |
| 20424 | else | ||
| 20425 | { | ||
| 20426 |
2/2✓ Branch 0 taken 110592 times.
✓ Branch 1 taken 216 times.
|
110808 | for(int32_t i=0; i<MAXLEVELS; i++) |
| 20427 | { | ||
| 20428 |
1/2✓ Branch 0 taken 110592 times.
✗ Branch 1 not taken.
|
110592 | if(!p_getc(&(temp_zinit.level_keys[i]),f)) |
| 20429 | { | ||
| 20430 | ✗ | return qe_invalid; | |
| 20431 | } | ||
| 20432 | 110592 | } | |
| 20433 | } | ||
| 20434 | 216 | } | |
| 20435 | |||
| 20436 |
2/2✓ Branch 0 taken 64 times.
✓ Branch 1 taken 216 times.
|
280 | if(s_version>3) |
| 20437 | { | ||
| 20438 |
1/2✓ Branch 0 taken 216 times.
✗ Branch 1 not taken.
|
216 | if(!p_igetw(&temp_zinit.ss_grid_x,f)) |
| 20439 | { | ||
| 20440 | ✗ | return qe_invalid; | |
| 20441 | } | ||
| 20442 | |||
| 20443 |
1/2✓ Branch 0 taken 216 times.
✗ Branch 1 not taken.
|
216 | if(!p_igetw(&temp_zinit.ss_grid_y,f)) |
| 20444 | { | ||
| 20445 | ✗ | return qe_invalid; | |
| 20446 | } | ||
| 20447 | |||
| 20448 |
1/2✓ Branch 0 taken 216 times.
✗ Branch 1 not taken.
|
216 | if(!p_igetw(&temp_zinit.ss_grid_xofs,f)) |
| 20449 | { | ||
| 20450 | ✗ | return qe_invalid; | |
| 20451 | } | ||
| 20452 | |||
| 20453 |
1/2✓ Branch 0 taken 216 times.
✗ Branch 1 not taken.
|
216 | if(!p_igetw(&temp_zinit.ss_grid_yofs,f)) |
| 20454 | { | ||
| 20455 | ✗ | return qe_invalid; | |
| 20456 | } | ||
| 20457 | |||
| 20458 |
1/2✓ Branch 0 taken 216 times.
✗ Branch 1 not taken.
|
216 | if(!p_igetw(&temp_zinit.ss_grid_color,f)) |
| 20459 | { | ||
| 20460 | ✗ | return qe_invalid; | |
| 20461 | } | ||
| 20462 | |||
| 20463 |
1/2✓ Branch 0 taken 216 times.
✗ Branch 1 not taken.
|
216 | if(!p_igetw(&temp_zinit.ss_bbox_1_color,f)) |
| 20464 | { | ||
| 20465 | ✗ | return qe_invalid; | |
| 20466 | } | ||
| 20467 | |||
| 20468 |
1/2✓ Branch 0 taken 216 times.
✗ Branch 1 not taken.
|
216 | if(!p_igetw(&temp_zinit.ss_bbox_2_color,f)) |
| 20469 | { | ||
| 20470 | ✗ | return qe_invalid; | |
| 20471 | } | ||
| 20472 | |||
| 20473 |
1/2✓ Branch 0 taken 216 times.
✗ Branch 1 not taken.
|
216 | if(!p_igetw(&temp_zinit.ss_flags,f)) |
| 20474 | { | ||
| 20475 | ✗ | return qe_invalid; | |
| 20476 | } | ||
| 20477 | |||
| 20478 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 216 times.
|
216 | temp_zinit.ss_grid_x=zc_max(temp_zinit.ss_grid_x,1); |
| 20479 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 216 times.
|
216 | temp_zinit.ss_grid_y=zc_max(temp_zinit.ss_grid_y,1); |
| 20480 | 216 | } | |
| 20481 | |||
| 20482 |
3/4✓ Branch 0 taken 216 times.
✓ Branch 1 taken 64 times.
✓ Branch 2 taken 216 times.
✗ Branch 3 not taken.
|
280 | if(s_version>4 && s_version<15) |
| 20483 | { | ||
| 20484 | ✗ | if(!p_getc(&moving_fairy_hearts,f)) | |
| 20485 | { | ||
| 20486 | ✗ | return qe_invalid; | |
| 20487 | } | ||
| 20488 | |||
| 20489 | ✗ | if(!p_getc(&moving_fairy_heart_percent,f)) | |
| 20490 | { | ||
| 20491 | ✗ | return qe_invalid; | |
| 20492 | } | ||
| 20493 | ✗ | } | |
| 20494 | |||
| 20495 |
3/4✓ Branch 0 taken 216 times.
✓ Branch 1 taken 64 times.
✓ Branch 2 taken 216 times.
✗ Branch 3 not taken.
|
280 | if(s_version>5 && s_version < 10) |
| 20496 | { | ||
| 20497 | ✗ | if(!p_getc(&temp,f)) | |
| 20498 | { | ||
| 20499 | ✗ | return qe_invalid; | |
| 20500 | } | ||
| 20501 | |||
| 20502 | ✗ | addOldStyleFamily(&temp_zinit, itemsbuf, itype_quiver, temp); | |
| 20503 | ✗ | } | |
| 20504 | |||
| 20505 |
3/4✓ Branch 0 taken 216 times.
✓ Branch 1 taken 64 times.
✓ Branch 2 taken 216 times.
✗ Branch 3 not taken.
|
280 | if(s_version>6 && s_version<15) |
| 20506 | { | ||
| 20507 | ✗ | if(!p_getc(&stationary_fairy_hearts,f)) | |
| 20508 | { | ||
| 20509 | ✗ | return qe_invalid; | |
| 20510 | } | ||
| 20511 | |||
| 20512 | ✗ | if(!p_getc(&stationary_fairy_heart_percent,f)) | |
| 20513 | { | ||
| 20514 | ✗ | return qe_invalid; | |
| 20515 | } | ||
| 20516 | |||
| 20517 | ✗ | if(!p_getc(&moving_fairy_magic,f)) | |
| 20518 | { | ||
| 20519 | ✗ | return qe_invalid; | |
| 20520 | } | ||
| 20521 | |||
| 20522 | ✗ | if(!p_getc(&moving_fairy_magic_percent,f)) | |
| 20523 | { | ||
| 20524 | ✗ | return qe_invalid; | |
| 20525 | } | ||
| 20526 | |||
| 20527 | ✗ | if(!p_getc(&stationary_fairy_magic,f)) | |
| 20528 | { | ||
| 20529 | ✗ | return qe_invalid; | |
| 20530 | } | ||
| 20531 | |||
| 20532 | ✗ | if(!p_getc(&stationary_fairy_magic_percent,f)) | |
| 20533 | { | ||
| 20534 | ✗ | return qe_invalid; | |
| 20535 | } | ||
| 20536 | |||
| 20537 | ✗ | if(!p_getc(&blue_potion_hearts,f)) | |
| 20538 | { | ||
| 20539 | ✗ | return qe_invalid; | |
| 20540 | } | ||
| 20541 | |||
| 20542 | ✗ | if(!p_getc(&blue_potion_heart_percent,f)) | |
| 20543 | { | ||
| 20544 | ✗ | return qe_invalid; | |
| 20545 | } | ||
| 20546 | |||
| 20547 | ✗ | if(!p_getc(&red_potion_hearts,f)) | |
| 20548 | { | ||
| 20549 | ✗ | return qe_invalid; | |
| 20550 | } | ||
| 20551 | |||
| 20552 | ✗ | if(!p_getc(&red_potion_heart_percent,f)) | |
| 20553 | { | ||
| 20554 | ✗ | return qe_invalid; | |
| 20555 | } | ||
| 20556 | |||
| 20557 | ✗ | if(!p_getc(&blue_potion_magic,f)) | |
| 20558 | { | ||
| 20559 | ✗ | return qe_invalid; | |
| 20560 | } | ||
| 20561 | |||
| 20562 | ✗ | if(!p_getc(&blue_potion_magic_percent,f)) | |
| 20563 | { | ||
| 20564 | ✗ | return qe_invalid; | |
| 20565 | } | ||
| 20566 | |||
| 20567 | ✗ | if(!p_getc(&red_potion_magic,f)) | |
| 20568 | { | ||
| 20569 | ✗ | return qe_invalid; | |
| 20570 | } | ||
| 20571 | |||
| 20572 | ✗ | if(!p_getc(&red_potion_magic_percent,f)) | |
| 20573 | { | ||
| 20574 | ✗ | return qe_invalid; | |
| 20575 | } | ||
| 20576 | ✗ | } | |
| 20577 | |||
| 20578 |
2/2✓ Branch 0 taken 64 times.
✓ Branch 1 taken 216 times.
|
280 | if(s_version>6) |
| 20579 |
1/2✓ Branch 0 taken 216 times.
✗ Branch 1 not taken.
|
216 | if(!p_getc(&padding,f)) |
| 20580 | ✗ | return qe_invalid; | |
| 20581 | |||
| 20582 |
2/2✓ Branch 0 taken 64 times.
✓ Branch 1 taken 216 times.
|
280 | if(s_version>7) |
| 20583 | { | ||
| 20584 |
1/2✓ Branch 0 taken 216 times.
✗ Branch 1 not taken.
|
216 | if(!p_getc(&padding,f)) |
| 20585 | { | ||
| 20586 | ✗ | return qe_invalid; | |
| 20587 | } | ||
| 20588 | 216 | } | |
| 20589 | |||
| 20590 |
2/2✓ Branch 0 taken 64 times.
✓ Branch 1 taken 216 times.
|
280 | if(s_version>8) |
| 20591 | { | ||
| 20592 |
1/2✓ Branch 0 taken 216 times.
✗ Branch 1 not taken.
|
216 | if(!p_igetw(&temp_zinit.mcounter[crMONEY],f)) |
| 20593 | { | ||
| 20594 | ✗ | return qe_invalid; | |
| 20595 | } | ||
| 20596 | |||
| 20597 |
1/2✓ Branch 0 taken 216 times.
✗ Branch 1 not taken.
|
216 | if(!p_igetw(&temp_zinit.mcounter[crKEYS],f)) |
| 20598 | { | ||
| 20599 | ✗ | return qe_invalid; | |
| 20600 | } | ||
| 20601 | 216 | } | |
| 20602 | |||
| 20603 |
2/2✓ Branch 0 taken 216 times.
✓ Branch 1 taken 64 times.
|
280 | if(s_version>16) |
| 20604 | { | ||
| 20605 |
1/2✓ Branch 0 taken 216 times.
✗ Branch 1 not taken.
|
216 | if(!p_getc(&tempbyte,f)) |
| 20606 | { | ||
| 20607 | ✗ | return qe_invalid; | |
| 20608 | } | ||
| 20609 | 216 | temp_zinit.gravity = tempbyte*100; | |
| 20610 |
1/2✓ Branch 0 taken 216 times.
✗ Branch 1 not taken.
|
216 | if(!p_igetw(&temp_zinit.terminalv,f)) |
| 20611 | { | ||
| 20612 | ✗ | return qe_invalid; | |
| 20613 | } | ||
| 20614 | |||
| 20615 |
1/2✓ Branch 0 taken 216 times.
✗ Branch 1 not taken.
|
216 | if(!p_getc(&temp_zinit.msg_speed,f)) |
| 20616 | { | ||
| 20617 | ✗ | return qe_invalid; | |
| 20618 | } | ||
| 20619 | |||
| 20620 |
1/2✓ Branch 0 taken 216 times.
✗ Branch 1 not taken.
|
216 | if(!p_getc(&padding,f)) |
| 20621 | { | ||
| 20622 | ✗ | return qe_invalid; | |
| 20623 | } | ||
| 20624 | |||
| 20625 |
1/2✓ Branch 0 taken 216 times.
✗ Branch 1 not taken.
|
216 | if(!p_getc(&temp_zinit.jump_hero_layer_threshold,f)) |
| 20626 | { | ||
| 20627 | ✗ | return qe_invalid; | |
| 20628 | } | ||
| 20629 | 216 | } | |
| 20630 |
2/2✓ Branch 0 taken 52 times.
✓ Branch 1 taken 12 times.
|
64 | else if (replay_version_check(0, 13)) |
| 20631 | 12 | temp_zinit.msg_speed = 0; | |
| 20632 | |||
| 20633 |
2/2✓ Branch 0 taken 64 times.
✓ Branch 1 taken 216 times.
|
280 | if(s_version>17) |
| 20634 | { | ||
| 20635 |
1/2✓ Branch 0 taken 216 times.
✗ Branch 1 not taken.
|
216 | if(!p_getc(&temp_zinit.msg_more_is_offset,f)) |
| 20636 | { | ||
| 20637 | ✗ | return qe_invalid; | |
| 20638 | } | ||
| 20639 | 216 | } | |
| 20640 | |||
| 20641 | //expaned init data for larger values in 2.55 | ||
| 20642 |
2/2✓ Branch 0 taken 264 times.
✓ Branch 1 taken 16 times.
|
280 | if ( s_version >= 19 ) //expand init data bombs, sbombs, and arrows to 0xFFFF |
| 20643 | { | ||
| 20644 |
1/2✓ Branch 0 taken 16 times.
✗ Branch 1 not taken.
|
16 | if(!p_igetw(&temp_zinit.counter[crBOMBS],f)) |
| 20645 | { | ||
| 20646 | ✗ | return qe_invalid; | |
| 20647 | } | ||
| 20648 |
1/2✓ Branch 0 taken 16 times.
✗ Branch 1 not taken.
|
16 | if(!p_igetw(&temp_zinit.counter[crSBOMBS],f)) |
| 20649 | { | ||
| 20650 | ✗ | return qe_invalid; | |
| 20651 | } | ||
| 20652 |
1/2✓ Branch 0 taken 16 times.
✗ Branch 1 not taken.
|
16 | if(!p_igetw(&temp_zinit.mcounter[crBOMBS],f)) |
| 20653 | { | ||
| 20654 | ✗ | return qe_invalid; | |
| 20655 | } | ||
| 20656 |
1/2✓ Branch 0 taken 16 times.
✗ Branch 1 not taken.
|
16 | if(!p_igetw(&temp_zinit.mcounter[crSBOMBS],f)) |
| 20657 | { | ||
| 20658 | ✗ | return qe_invalid; | |
| 20659 | } | ||
| 20660 |
1/2✓ Branch 0 taken 16 times.
✗ Branch 1 not taken.
|
16 | if(!p_igetw(&temp_zinit.counter[crARROWS],f)) |
| 20661 | { | ||
| 20662 | ✗ | return qe_invalid; | |
| 20663 | } | ||
| 20664 |
1/2✓ Branch 0 taken 16 times.
✗ Branch 1 not taken.
|
16 | if(!p_igetw(&temp_zinit.mcounter[crARROWS],f)) |
| 20665 | { | ||
| 20666 | ✗ | return qe_invalid; | |
| 20667 | } | ||
| 20668 | |||
| 20669 | 16 | } | |
| 20670 |
2/2✓ Branch 0 taken 16 times.
✓ Branch 1 taken 264 times.
|
280 | if ( s_version >= 20 ) |
| 20671 | { | ||
| 20672 |
1/2✓ Branch 0 taken 16 times.
✗ Branch 1 not taken.
|
16 | if(!p_igetw(&temp_zinit.heroStep,f)) |
| 20673 | { | ||
| 20674 | ✗ | return qe_invalid; | |
| 20675 | } | ||
| 20676 | 16 | } | |
| 20677 | else | ||
| 20678 | { | ||
| 20679 | 264 | temp_zinit.heroStep = 150; //1.5 pixels per frame | |
| 20680 | } | ||
| 20681 |
2/2✓ Branch 0 taken 16 times.
✓ Branch 1 taken 264 times.
|
280 | if ( s_version >= 21 ) |
| 20682 | { | ||
| 20683 |
1/2✓ Branch 0 taken 16 times.
✗ Branch 1 not taken.
|
16 | if(!p_igetw(&temp_zinit.subscrSpeed,f)) |
| 20684 | { | ||
| 20685 | ✗ | return qe_invalid; | |
| 20686 | } | ||
| 20687 | 16 | } | |
| 20688 | else | ||
| 20689 | { | ||
| 20690 | 264 | temp_zinit.subscrSpeed = 1; //3 pixels per frame | |
| 20691 | } | ||
| 20692 | //old only | ||
| 20693 |
4/4✓ Branch 0 taken 5 times.
✓ Branch 1 taken 275 times.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 4 times.
|
280 | if((Header->zelda_version == 0x192)&&(Header->build<174)) |
| 20694 | { | ||
| 20695 | byte items2; | ||
| 20696 | |||
| 20697 |
1/2✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
|
4 | if(!p_getc(&items2,f)) |
| 20698 | { | ||
| 20699 | ✗ | return qe_invalid; | |
| 20700 | } | ||
| 20701 | |||
| 20702 | 4 | temp_zinit.set_item(iDivineFire, get_bit(&items2, idI_DFIRE)!=0); | |
| 20703 | 4 | temp_zinit.set_item(iDivineEscape, get_bit(&items2, idI_FWIND)!=0); | |
| 20704 | 4 | temp_zinit.set_item(iDivineProtection, get_bit(&items2, idI_NLOVE)!=0); | |
| 20705 | 4 | } | |
| 20706 | |||
| 20707 |
2/2✓ Branch 0 taken 275 times.
✓ Branch 1 taken 5 times.
|
280 | if(Header->zelda_version < 0x193) |
| 20708 | { | ||
| 20709 |
2/2✓ Branch 0 taken 480 times.
✓ Branch 1 taken 5 times.
|
485 | for(int32_t q=0; q<96; q++) |
| 20710 | { | ||
| 20711 |
1/2✓ Branch 0 taken 480 times.
✗ Branch 1 not taken.
|
480 | if(!p_getc(&padding,f)) |
| 20712 | { | ||
| 20713 | ✗ | return qe_invalid; | |
| 20714 | } | ||
| 20715 | 480 | } | |
| 20716 | |||
| 20717 | //new only | ||
| 20718 |
3/4✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
✓ Branch 3 taken 1 times.
|
5 | if((Header->zelda_version == 0x192)&&(Header->build>173)) |
| 20719 | { | ||
| 20720 |
1/2✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
|
1 | if(!p_getc(&padding,f)) |
| 20721 | { | ||
| 20722 | ✗ | return qe_invalid; | |
| 20723 | } | ||
| 20724 | |||
| 20725 |
1/2✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
|
1 | if(!p_getc(&padding,f)) |
| 20726 | { | ||
| 20727 | ✗ | return qe_invalid; | |
| 20728 | } | ||
| 20729 | 1 | } | |
| 20730 | 5 | } | |
| 20731 | 280 | } | |
| 20732 | |||
| 20733 |
3/6✓ Branch 0 taken 216 times.
✓ Branch 1 taken 82 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 216 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
298 | if((Header->zelda_version < 0x211)||((Header->zelda_version == 0x211)&&(Header->build<15))) |
| 20734 | { | ||
| 20735 | //temp_zinit.shield=i_smallshield; | ||
| 20736 | 82 | int32_t sshieldid = getItemID(itemsbuf, itype_shield, i_smallshield); | |
| 20737 | |||
| 20738 |
1/2✓ Branch 0 taken 82 times.
✗ Branch 1 not taken.
|
82 | if(sshieldid != -1) |
| 20739 | 82 | temp_zinit.set_item(sshieldid, true); | |
| 20740 | 82 | } | |
| 20741 | |||
| 20742 |
5/6✓ Branch 0 taken 280 times.
✓ Branch 1 taken 18 times.
✓ Branch 2 taken 5 times.
✓ Branch 3 taken 275 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 5 times.
|
298 | if((Header->zelda_version < 0x192)||((Header->zelda_version == 0x192)&&(Header->build<27))) |
| 20743 | { | ||
| 20744 | 18 | temp_zinit.mcounter[crLIFE]=3; | |
| 20745 | 18 | temp_zinit.counter[crLIFE]=3; | |
| 20746 | 18 | temp_zinit.cont_heart=3; | |
| 20747 | 18 | temp_zinit.mcounter[crBOMBS]=8; | |
| 20748 | 18 | } | |
| 20749 | |||
| 20750 |
5/6✓ Branch 0 taken 280 times.
✓ Branch 1 taken 18 times.
✓ Branch 2 taken 5 times.
✓ Branch 3 taken 275 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 5 times.
|
298 | if((Header->zelda_version < 0x192)||((Header->zelda_version == 0x192)&&(Header->build<50))) |
| 20751 | { | ||
| 20752 | 18 | sword_hearts[0]=0; | |
| 20753 | 18 | sword_hearts[1]=5; | |
| 20754 | 18 | sword_hearts[2]=12; | |
| 20755 | 18 | sword_hearts[3]=21; | |
| 20756 | 18 | } | |
| 20757 | |||
| 20758 |
5/6✓ Branch 0 taken 280 times.
✓ Branch 1 taken 18 times.
✓ Branch 2 taken 5 times.
✓ Branch 3 taken 275 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 5 times.
|
298 | if((Header->zelda_version < 0x192)||((Header->zelda_version == 0x192)&&(Header->build<51))) |
| 20759 | { | ||
| 20760 | 18 | temp_zinit.last_map=0; | |
| 20761 | 18 | temp_zinit.last_screen=0; | |
| 20762 | 18 | } | |
| 20763 | |||
| 20764 |
5/6✓ Branch 0 taken 280 times.
✓ Branch 1 taken 18 times.
✓ Branch 2 taken 5 times.
✓ Branch 3 taken 275 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 5 times.
|
298 | if((Header->zelda_version < 0x192)||((Header->zelda_version == 0x192)&&(Header->build<68))) |
| 20765 | { | ||
| 20766 | 18 | temp_zinit.mcounter[crMAGIC]=0; | |
| 20767 | 18 | temp_zinit.counter[crMAGIC]=0; | |
| 20768 | 18 | temp_zinit.magicdrainrate = 2; | |
| 20769 | 18 | } | |
| 20770 | |||
| 20771 |
5/6✓ Branch 0 taken 280 times.
✓ Branch 1 taken 18 times.
✓ Branch 2 taken 5 times.
✓ Branch 3 taken 275 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 5 times.
|
298 | if((Header->zelda_version < 0x192)||((Header->zelda_version == 0x192)&&(Header->build<129))) |
| 20772 | { | ||
| 20773 | |||
| 20774 |
2/2✓ Branch 0 taken 72 times.
✓ Branch 1 taken 18 times.
|
90 | for(int32_t x=0; x<4; x++) |
| 20775 | { | ||
| 20776 | 72 | beam_hearts[x]=100; | |
| 20777 | 72 | } | |
| 20778 | |||
| 20779 |
2/2✓ Branch 0 taken 72 times.
✓ Branch 1 taken 18 times.
|
90 | for(int32_t i=0; i<idBP_MAX; i++) |
| 20780 | { | ||
| 20781 | 72 | set_bit(&beam_percent,i,!get_qr(qr_LENSHINTS+i)); | |
| 20782 | 72 | set_qr(qr_LENSHINTS+i,0); | |
| 20783 | 72 | } | |
| 20784 | |||
| 20785 |
2/2✓ Branch 0 taken 72 times.
✓ Branch 1 taken 18 times.
|
90 | for(int32_t x=0; x<4; x++) |
| 20786 | { | ||
| 20787 | 72 | beam_power[x]=get_qr(qr_HIDECARRIEDITEMS)?50:100; | |
| 20788 | 72 | } | |
| 20789 | |||
| 20790 | 18 | set_qr(qr_HIDECARRIEDITEMS,0); | |
| 20791 | 18 | hookshot_links=100; | |
| 20792 | 18 | temp_zinit.msg_more_x=224; | |
| 20793 | 18 | temp_zinit.msg_more_y=64; | |
| 20794 | 18 | } | |
| 20795 | |||
| 20796 | // Okay, let's put these legacy values into itemsbuf. | ||
| 20797 |
2/2✓ Branch 0 taken 216 times.
✓ Branch 1 taken 82 times.
|
298 | if(s_version < 15) |
| 20798 |
2/2✓ Branch 0 taken 20992 times.
✓ Branch 1 taken 82 times.
|
21074 | for(int32_t i=0; i<MAXITEMS; i++) |
| 20799 | { | ||
| 20800 |
11/11✓ Branch 0 taken 82 times.
✓ Branch 1 taken 82 times.
✓ Branch 2 taken 82 times.
✓ Branch 3 taken 82 times.
✓ Branch 4 taken 82 times.
✓ Branch 5 taken 82 times.
✓ Branch 6 taken 82 times.
✓ Branch 7 taken 82 times.
✓ Branch 8 taken 20172 times.
✓ Branch 9 taken 82 times.
✓ Branch 10 taken 82 times.
|
20992 | switch(i) |
| 20801 | { | ||
| 20802 | case iFairyStill: | ||
| 20803 | 82 | itemsbuf[i].misc1 = stationary_fairy_hearts; | |
| 20804 | 82 | itemsbuf[i].misc2 = stationary_fairy_magic; | |
| 20805 | 82 | itemsbuf[i].misc3 = 0; | |
| 20806 |
1/2✓ Branch 0 taken 82 times.
✗ Branch 1 not taken.
|
82 | if (stationary_fairy_heart_percent) itemsbuf[i].flags |= item_flag1; |
| 20807 |
1/2✓ Branch 0 taken 82 times.
✗ Branch 1 not taken.
|
82 | if (stationary_fairy_magic_percent) itemsbuf[i].flags |= item_flag2; |
| 20808 | 82 | break; | |
| 20809 | |||
| 20810 | case iFairyMoving: | ||
| 20811 | 82 | itemsbuf[i].misc1 = moving_fairy_hearts; | |
| 20812 | 82 | itemsbuf[i].misc2 = moving_fairy_magic; | |
| 20813 | 82 | itemsbuf[i].misc3 = 50; | |
| 20814 |
1/2✓ Branch 0 taken 82 times.
✗ Branch 1 not taken.
|
82 | if (moving_fairy_heart_percent) itemsbuf[i].flags |= item_flag1; |
| 20815 |
1/2✓ Branch 0 taken 82 times.
✗ Branch 1 not taken.
|
82 | if (moving_fairy_magic_percent) itemsbuf[i].flags |= item_flag2; |
| 20816 | 82 | break; | |
| 20817 | |||
| 20818 | case iRPotion: | ||
| 20819 | 82 | itemsbuf[i].misc1 = red_potion_hearts; | |
| 20820 | 82 | itemsbuf[i].misc2 = red_potion_magic; | |
| 20821 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 82 times.
|
82 | if (red_potion_heart_percent) itemsbuf[i].flags |= item_flag1; |
| 20822 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 82 times.
|
82 | if (red_potion_magic_percent) itemsbuf[i].flags |= item_flag2; |
| 20823 | 82 | break; | |
| 20824 | |||
| 20825 | case iBPotion: | ||
| 20826 | 82 | itemsbuf[i].misc1 = blue_potion_hearts; | |
| 20827 | 82 | itemsbuf[i].misc2 = blue_potion_magic; | |
| 20828 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 82 times.
|
82 | if (blue_potion_heart_percent) itemsbuf[i].flags |= item_flag1; |
| 20829 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 82 times.
|
82 | if (blue_potion_magic_percent) itemsbuf[i].flags |= item_flag2; |
| 20830 | 82 | break; | |
| 20831 | |||
| 20832 | case iSword: | ||
| 20833 | 82 | itemsbuf[i].pickup_hearts = sword_hearts[0]; | |
| 20834 | 82 | itemsbuf[i].misc1 = beam_hearts[0]; | |
| 20835 | 82 | itemsbuf[i].misc2 = beam_power[0]; | |
| 20836 | // It seems that item_flag1 was already added by reset_itembuf()... | ||
| 20837 | 82 | itemsbuf[i].flags &= (!get_bit(&beam_percent,0)) ? ~item_flag1 : ~item_none; | |
| 20838 | 82 | break; | |
| 20839 | |||
| 20840 | case iWSword: | ||
| 20841 | 82 | itemsbuf[i].pickup_hearts = sword_hearts[1]; | |
| 20842 | 82 | itemsbuf[i].misc1 = beam_hearts[1]; | |
| 20843 | 82 | itemsbuf[i].misc2 = beam_power[1]; | |
| 20844 | 82 | itemsbuf[i].flags &= (!get_bit(&beam_percent,1)) ? ~item_flag1 : ~item_none; | |
| 20845 | 82 | break; | |
| 20846 | |||
| 20847 | case iMSword: | ||
| 20848 | 82 | itemsbuf[i].pickup_hearts = sword_hearts[2]; | |
| 20849 | 82 | itemsbuf[i].misc1 = beam_hearts[2]; | |
| 20850 | 82 | itemsbuf[i].misc2 = beam_power[2]; | |
| 20851 | 82 | itemsbuf[i].flags &= (!get_bit(&beam_percent,2)) ? ~item_flag1 : ~item_none; | |
| 20852 | 82 | break; | |
| 20853 | |||
| 20854 | case iXSword: | ||
| 20855 | 82 | itemsbuf[i].pickup_hearts = sword_hearts[3]; | |
| 20856 | 82 | itemsbuf[i].misc1 = beam_hearts[3]; | |
| 20857 | 82 | itemsbuf[i].misc2 = beam_power[3]; | |
| 20858 | 82 | itemsbuf[i].flags &= (!get_bit(&beam_percent,3)) ? ~item_flag1 : ~item_none; | |
| 20859 | 82 | break; | |
| 20860 | |||
| 20861 | case iHookshot: | ||
| 20862 | 82 | itemsbuf[i].misc1 = hookshot_length; | |
| 20863 | 82 | itemsbuf[i].misc2 = hookshot_links; | |
| 20864 | 82 | break; | |
| 20865 | |||
| 20866 | case iLongshot: | ||
| 20867 | 82 | itemsbuf[i].misc1 = longshot_length; | |
| 20868 | 82 | itemsbuf[i].misc2 = longshot_links; | |
| 20869 | 82 | break; | |
| 20870 | } | ||
| 20871 | 21074 | } | |
| 20872 | |||
| 20873 |
6/6✓ Branch 0 taken 280 times.
✓ Branch 1 taken 18 times.
✓ Branch 2 taken 5 times.
✓ Branch 3 taken 275 times.
✓ Branch 4 taken 4 times.
✓ Branch 5 taken 1 times.
|
298 | if((Header->zelda_version < 0x192)||((Header->zelda_version == 0x192)&&(Header->build<168))) |
| 20874 | { | ||
| 20875 | //was new subscreen rule | ||
| 20876 | 22 | subscr_mode=get_qr(qr_FREEFORM)?1:0; | |
| 20877 | 22 | set_qr(qr_FREEFORM,0); | |
| 20878 | 22 | } | |
| 20879 | |||
| 20880 |
5/6✓ Branch 0 taken 280 times.
✓ Branch 1 taken 18 times.
✓ Branch 2 taken 5 times.
✓ Branch 3 taken 275 times.
✓ Branch 4 taken 5 times.
✗ Branch 5 not taken.
|
298 | if((Header->zelda_version < 0x192)||((Header->zelda_version == 0x192)&&(Header->build<185))) |
| 20881 | { | ||
| 20882 | 23 | temp_zinit.start_dmap=0; | |
| 20883 | 23 | } | |
| 20884 | |||
| 20885 |
5/6✓ Branch 0 taken 280 times.
✓ Branch 1 taken 18 times.
✓ Branch 2 taken 5 times.
✓ Branch 3 taken 275 times.
✓ Branch 4 taken 5 times.
✗ Branch 5 not taken.
|
298 | if((Header->zelda_version < 0x192)||((Header->zelda_version == 0x192)&&(Header->build<186))) |
| 20886 | { | ||
| 20887 | 23 | temp_zinit.heroAnimationStyle=get_qr(qr_BSZELDA)?1:0; | |
| 20888 | 23 | } | |
| 20889 | |||
| 20890 |
3/4✓ Branch 0 taken 82 times.
✓ Branch 1 taken 216 times.
✓ Branch 2 taken 82 times.
✗ Branch 3 not taken.
|
298 | if(s_version < 16 && get_bit(deprecated_rules, qr_COOLSCROLL+1)) |
| 20891 | { | ||
| 20892 | //addOldStyleFamily(&temp_zinit, itemsbuf, itype_wallet, 4); //is this needed? | ||
| 20893 | ✗ | temp_zinit.mcounter[crMONEY]=999; | |
| 20894 | //temp_zinit.counter[crMONEY]=999; //This rule only gave you an invisible max wallet; it did not give you max rupies. | ||
| 20895 | ✗ | } | |
| 20896 |
2/2✓ Branch 0 taken 292 times.
✓ Branch 1 taken 6 times.
|
298 | if(Header->zelda_version < 0x190) //1.84 bugfix. -Z |
| 20897 | { | ||
| 20898 | //temp_zinit.items[iBombBag] = true; //No, this is 30 max bombs! | ||
| 20899 | 6 | temp_zinit.mcounter[crBOMBS] = 8; | |
| 20900 | 6 | } | |
| 20901 | // al_trace("About to copy over new init data values for quest made in: %x\n", Header->zelda_version); | ||
| 20902 | //time to ensure that we port all new values properly: | ||
| 20903 |
2/2✓ Branch 0 taken 216 times.
✓ Branch 1 taken 82 times.
|
298 | if(Header->zelda_version < 0x250) |
| 20904 | { | ||
| 20905 |
1/2✓ Branch 0 taken 82 times.
✗ Branch 1 not taken.
|
82 | temp_zinit.mcounter[crSBOMBS] = bomb_ratio > 0 ? ( temp_zinit.mcounter[crBOMBS]/temp_zinit.bomb_ratio ) : (temp_zinit.mcounter[crBOMBS]/4); |
| 20906 | 82 | } | |
| 20907 | |||
| 20908 |
2/2✓ Branch 0 taken 16 times.
✓ Branch 1 taken 282 times.
|
298 | if(s_version > 21) |
| 20909 | { | ||
| 20910 |
1/2✓ Branch 0 taken 16 times.
✗ Branch 1 not taken.
|
16 | if(!p_getc(&temp_zinit.hp_per_heart,f)) |
| 20911 | { | ||
| 20912 | ✗ | return qe_invalid; | |
| 20913 | } | ||
| 20914 |
1/2✓ Branch 0 taken 16 times.
✗ Branch 1 not taken.
|
16 | if(!p_getc(&temp_zinit.magic_per_block,f)) |
| 20915 | { | ||
| 20916 | ✗ | return qe_invalid; | |
| 20917 | } | ||
| 20918 |
1/2✓ Branch 0 taken 16 times.
✗ Branch 1 not taken.
|
16 | if(!p_getc(&temp_zinit.hero_damage_multiplier,f)) |
| 20919 | { | ||
| 20920 | ✗ | return qe_invalid; | |
| 20921 | } | ||
| 20922 |
1/2✓ Branch 0 taken 16 times.
✗ Branch 1 not taken.
|
16 | if(!p_getc(&temp_zinit.ene_damage_multiplier,f)) |
| 20923 | { | ||
| 20924 | ✗ | return qe_invalid; | |
| 20925 | } | ||
| 20926 | 16 | } | |
| 20927 | else | ||
| 20928 | { | ||
| 20929 | 282 | temp_zinit.hp_per_heart = 16; //HP_PER_HEART, previously hardcoded | |
| 20930 | 282 | temp_zinit.magic_per_block = 32; //MAGICPERBLOCK, previously hardcoded | |
| 20931 | 282 | temp_zinit.hero_damage_multiplier = 2; //DAMAGE_MULTIPLIER, previously hardcoded | |
| 20932 | 282 | temp_zinit.ene_damage_multiplier = 4; //(HP_PER_HEART/4), previously hardcoded | |
| 20933 | } | ||
| 20934 | |||
| 20935 |
2/2✓ Branch 0 taken 282 times.
✓ Branch 1 taken 16 times.
|
298 | if(s_version > 22) |
| 20936 | { | ||
| 20937 |
2/2✓ Branch 0 taken 400 times.
✓ Branch 1 taken 16 times.
|
416 | for(int32_t q = crCUSTOM1; q <= crCUSTOM25; ++q) |
| 20938 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 400 times.
|
400 | if(!p_igetw(&temp_zinit.counter[q],f)) |
| 20939 | ✗ | return qe_invalid; | |
| 20940 |
2/2✓ Branch 0 taken 400 times.
✓ Branch 1 taken 16 times.
|
416 | for(int32_t q = crCUSTOM1; q <= crCUSTOM25; ++q) |
| 20941 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 400 times.
|
400 | if(!p_igetw(&temp_zinit.mcounter[q],f)) |
| 20942 | ✗ | return qe_invalid; | |
| 20943 | 16 | } | |
| 20944 | |||
| 20945 | |||
| 20946 |
2/2✓ Branch 0 taken 16 times.
✓ Branch 1 taken 282 times.
|
298 | if(s_version > 23) |
| 20947 | { | ||
| 20948 |
1/2✓ Branch 0 taken 16 times.
✗ Branch 1 not taken.
|
16 | if(!p_getc(&temp_zinit.dither_type,f)) |
| 20949 | { | ||
| 20950 | ✗ | return qe_invalid; | |
| 20951 | } | ||
| 20952 |
1/2✓ Branch 0 taken 16 times.
✗ Branch 1 not taken.
|
16 | if(!p_getc(&temp_zinit.dither_arg,f)) |
| 20953 | { | ||
| 20954 | ✗ | return qe_invalid; | |
| 20955 | } | ||
| 20956 |
1/2✓ Branch 0 taken 16 times.
✗ Branch 1 not taken.
|
16 | if(!p_getc(&temp_zinit.dither_percent,f)) |
| 20957 | { | ||
| 20958 | ✗ | return qe_invalid; | |
| 20959 | } | ||
| 20960 |
1/2✓ Branch 0 taken 16 times.
✗ Branch 1 not taken.
|
16 | if(!p_getc(&temp_zinit.def_lightrad,f)) |
| 20961 | { | ||
| 20962 | ✗ | return qe_invalid; | |
| 20963 | } | ||
| 20964 |
1/2✓ Branch 0 taken 16 times.
✗ Branch 1 not taken.
|
16 | if(!p_getc(&temp_zinit.transdark_percent,f)) |
| 20965 | { | ||
| 20966 | ✗ | return qe_invalid; | |
| 20967 | } | ||
| 20968 | 16 | } | |
| 20969 | else | ||
| 20970 | { | ||
| 20971 | 282 | temp_zinit.dither_type = 0; | |
| 20972 | 282 | temp_zinit.dither_arg = 0; | |
| 20973 | 282 | temp_zinit.dither_percent = 20; | |
| 20974 | 282 | temp_zinit.def_lightrad = 24; | |
| 20975 | 282 | temp_zinit.transdark_percent = 0; | |
| 20976 | } | ||
| 20977 | |||
| 20978 |
2/2✓ Branch 0 taken 16 times.
✓ Branch 1 taken 282 times.
|
298 | if(s_version > 24) |
| 20979 | { | ||
| 20980 |
1/2✓ Branch 0 taken 16 times.
✗ Branch 1 not taken.
|
16 | if(!p_getc(&temp_zinit.darkcol,f)) |
| 20981 | { | ||
| 20982 | ✗ | return qe_invalid; | |
| 20983 | } | ||
| 20984 | 16 | } | |
| 20985 | else | ||
| 20986 | { | ||
| 20987 | 282 | temp_zinit.darkcol = BLACK; | |
| 20988 | } | ||
| 20989 | |||
| 20990 |
2/2✓ Branch 0 taken 282 times.
✓ Branch 1 taken 16 times.
|
298 | if(s_version > 25) |
| 20991 | { | ||
| 20992 |
1/2✓ Branch 0 taken 16 times.
✗ Branch 1 not taken.
|
16 | if(!p_igetl(&temp_zinit.gravity,f)) |
| 20993 | { | ||
| 20994 | ✗ | return qe_invalid; | |
| 20995 | } | ||
| 20996 |
1/2✓ Branch 0 taken 16 times.
✗ Branch 1 not taken.
|
16 | if(!p_igetl(&temp_zinit.swimgravity,f)) |
| 20997 | { | ||
| 20998 | ✗ | return qe_invalid; | |
| 20999 | } | ||
| 21000 | 16 | } | |
| 21001 | |||
| 21002 | |||
| 21003 |
2/2✓ Branch 0 taken 16 times.
✓ Branch 1 taken 282 times.
|
298 | if(s_version > 26) |
| 21004 | { | ||
| 21005 |
1/2✓ Branch 0 taken 16 times.
✗ Branch 1 not taken.
|
16 | if(!p_igetw(&temp_zinit.heroSideswimUpStep,f)) |
| 21006 | { | ||
| 21007 | ✗ | return qe_invalid; | |
| 21008 | } | ||
| 21009 |
1/2✓ Branch 0 taken 16 times.
✗ Branch 1 not taken.
|
16 | if(!p_igetw(&temp_zinit.heroSideswimSideStep,f)) |
| 21010 | { | ||
| 21011 | ✗ | return qe_invalid; | |
| 21012 | } | ||
| 21013 |
1/2✓ Branch 0 taken 16 times.
✗ Branch 1 not taken.
|
16 | if(!p_igetw(&temp_zinit.heroSideswimDownStep,f)) |
| 21014 | { | ||
| 21015 | ✗ | return qe_invalid; | |
| 21016 | } | ||
| 21017 | 16 | } | |
| 21018 | else | ||
| 21019 | { | ||
| 21020 | 282 | temp_zinit.heroSideswimUpStep = 150; | |
| 21021 | 282 | temp_zinit.heroSideswimSideStep = 100; | |
| 21022 | 282 | temp_zinit.heroSideswimDownStep = 75; | |
| 21023 | } | ||
| 21024 | |||
| 21025 |
2/2✓ Branch 0 taken 16 times.
✓ Branch 1 taken 282 times.
|
298 | if(s_version > 27) |
| 21026 | { | ||
| 21027 |
1/2✓ Branch 0 taken 16 times.
✗ Branch 1 not taken.
|
16 | if(!p_igetl(&temp_zinit.exitWaterJump,f)) |
| 21028 | { | ||
| 21029 | ✗ | return qe_invalid; | |
| 21030 | } | ||
| 21031 | 16 | } | |
| 21032 | else | ||
| 21033 | { | ||
| 21034 | 282 | temp_zinit.exitWaterJump = 0; | |
| 21035 | } | ||
| 21036 | |||
| 21037 |
2/2✓ Branch 0 taken 16 times.
✓ Branch 1 taken 282 times.
|
298 | if(s_version > 29) |
| 21038 | { | ||
| 21039 |
1/2✓ Branch 0 taken 16 times.
✗ Branch 1 not taken.
|
16 | if(!p_igetl(&temp_zinit.bunny_ltm,f)) |
| 21040 | { | ||
| 21041 | ✗ | return qe_invalid; | |
| 21042 | } | ||
| 21043 | 16 | } | |
| 21044 | else | ||
| 21045 | { | ||
| 21046 | 282 | temp_zinit.bunny_ltm = 0; | |
| 21047 | } | ||
| 21048 | |||
| 21049 |
2/2✓ Branch 0 taken 16 times.
✓ Branch 1 taken 282 times.
|
298 | if(s_version > 30) |
| 21050 | { | ||
| 21051 |
1/2✓ Branch 0 taken 16 times.
✗ Branch 1 not taken.
|
16 | if(!p_getc(&temp_zinit.switchhookstyle,f)) |
| 21052 | { | ||
| 21053 | ✗ | return qe_invalid; | |
| 21054 | } | ||
| 21055 | 16 | } | |
| 21056 | else | ||
| 21057 | { | ||
| 21058 | 282 | temp_zinit.switchhookstyle = 1; | |
| 21059 | } | ||
| 21060 | |||
| 21061 |
2/2✓ Branch 0 taken 282 times.
✓ Branch 1 taken 16 times.
|
298 | if(s_version > 31) |
| 21062 | { | ||
| 21063 |
1/2✓ Branch 0 taken 16 times.
✗ Branch 1 not taken.
|
16 | if(!p_getc(&temp_zinit.magicdrainrate,f)) |
| 21064 | { | ||
| 21065 | ✗ | return qe_invalid; | |
| 21066 | } | ||
| 21067 | 16 | } | |
| 21068 | |||
| 21069 | 298 | temp_zinit.clear_genscript(); | |
| 21070 |
2/2✓ Branch 0 taken 286 times.
✓ Branch 1 taken 12 times.
|
298 | if(s_version > 32) |
| 21071 | { | ||
| 21072 | 12 | word numgenscript = 0; | |
| 21073 |
1/2✓ Branch 0 taken 12 times.
✗ Branch 1 not taken.
|
12 | if(!p_igetw(&numgenscript,f)) |
| 21074 | ✗ | return qe_invalid; | |
| 21075 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 12 times.
|
12 | if (numgenscript > NUMSCRIPTSGENERIC) |
| 21076 | ✗ | return qe_invalid; | |
| 21077 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 12 times.
|
12 | for(auto q = 1; q < numgenscript; ++q) |
| 21078 | { | ||
| 21079 | ✗ | if(!p_getc(&tempbyte,f)) | |
| 21080 | ✗ | return qe_invalid; | |
| 21081 | ✗ | if(!(tempbyte&2)) | |
| 21082 | ✗ | continue; | |
| 21083 | ✗ | temp_zinit.gen_doscript.set(q, tempbyte&1); | |
| 21084 | ✗ | if(!p_igetw(&temp_zinit.gen_exitState[q],f)) | |
| 21085 | ✗ | return qe_invalid; | |
| 21086 | ✗ | if(!p_igetw(&temp_zinit.gen_reloadState[q],f)) | |
| 21087 | ✗ | return qe_invalid; | |
| 21088 | ✗ | for(auto p = 0; p < 8; ++p) | |
| 21089 | ✗ | if(!p_igetl(&temp_zinit.gen_initd[q][p],f)) | |
| 21090 | ✗ | return qe_invalid; | |
| 21091 | dword sz; | ||
| 21092 | ✗ | if(!p_igetl(&sz,f)) | |
| 21093 | ✗ | return qe_invalid; | |
| 21094 | ✗ | temp_zinit.gen_data[q].resize(sz); | |
| 21095 | ✗ | std::vector<int32_t> dummy; | |
| 21096 | ✗ | if(!p_getlvec(&dummy,f)) | |
| 21097 | ✗ | return qe_invalid; | |
| 21098 | ✗ | temp_zinit.gen_data[q] = dummy; | |
| 21099 | ✗ | if(!p_igetl(&temp_zinit.gen_eventstate[q],f)) | |
| 21100 | ✗ | return qe_invalid; | |
| 21101 | ✗ | } | |
| 21102 | 12 | } | |
| 21103 |
2/2✓ Branch 0 taken 292 times.
✓ Branch 1 taken 6 times.
|
298 | if(s_version > 33) |
| 21104 | { | ||
| 21105 |
1/2✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
|
6 | if(!p_getc(&temp_zinit.hero_swim_mult,f)) |
| 21106 | ✗ | return qe_invalid; | |
| 21107 |
1/2✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
|
6 | if(!p_getc(&temp_zinit.hero_swim_div,f)) |
| 21108 | ✗ | return qe_invalid; | |
| 21109 | 6 | } | |
| 21110 |
1/2✓ Branch 0 taken 298 times.
✗ Branch 1 not taken.
|
298 | if(s_version > 34) |
| 21111 | { | ||
| 21112 | uint32_t num_used_mapscr_data; | ||
| 21113 | ✗ | if(!p_igetl(&num_used_mapscr_data,f)) | |
| 21114 | ✗ | return qe_invalid; | |
| 21115 | ✗ | for(uint32_t q = 0; q < num_used_mapscr_data; ++q) | |
| 21116 | { | ||
| 21117 | uint32_t sz; | ||
| 21118 | ✗ | if(!p_igetl(&sz,f)) | |
| 21119 | ✗ | return qe_invalid; | |
| 21120 | ✗ | temp_zinit.screen_data[q].resize(sz); | |
| 21121 | ✗ | if(sz) | |
| 21122 | { | ||
| 21123 | ✗ | std::vector<int32_t> dummy; | |
| 21124 | ✗ | if(!p_getlvec(&dummy,f)) | |
| 21125 | ✗ | return qe_invalid; | |
| 21126 | ✗ | temp_zinit.screen_data[q] = dummy; | |
| 21127 | ✗ | } | |
| 21128 | ✗ | } | |
| 21129 | ✗ | } | |
| 21130 |
1/2✓ Branch 0 taken 298 times.
✗ Branch 1 not taken.
|
298 | if (s_version > 35) |
| 21131 | ✗ | if(!p_igetzf(&temp_zinit.shove_offset,f)) | |
| 21132 | ✗ | return qe_invalid; | |
| 21133 | |||
| 21134 | 298 | temp_zinit.counter[crLIFE] *= temp_zinit.hp_per_heart; | |
| 21135 | 298 | temp_zinit.mcounter[crLIFE] *= temp_zinit.hp_per_heart; | |
| 21136 |
2/2✓ Branch 0 taken 188 times.
✓ Branch 1 taken 110 times.
|
298 | if(!temp_zinit.flags.get(INIT_FL_CONTPERCENT)) |
| 21137 | 110 | temp_zinit.cont_heart *= temp_zinit.hp_per_heart; | |
| 21138 | |||
| 21139 | 298 | return 0; | |
| 21140 | 298 | } | |
| 21141 | 478 | int32_t readinitdata(PACKFILE *f, zquestheader *Header) | |
| 21142 | { | ||
| 21143 | 478 | zinitdata temp_zinit = {}; | |
| 21144 | |||
| 21145 |
3/4✓ Branch 0 taken 455 times.
✓ Branch 1 taken 23 times.
✓ Branch 2 taken 23 times.
✗ Branch 3 not taken.
|
478 | bool should_skip = legacy_skip_flags && get_bit(legacy_skip_flags, skip_initdata); |
| 21146 | |||
| 21147 | int32_t dummy; | ||
| 21148 | 478 | word s_version=0; | |
| 21149 | byte padding; | ||
| 21150 | |||
| 21151 |
2/2✓ Branch 0 taken 455 times.
✓ Branch 1 taken 23 times.
|
478 | if(Header->zelda_version > 0x192) |
| 21152 | { | ||
| 21153 |
2/4✓ Branch 0 taken 455 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 455 times.
✗ Branch 3 not taken.
|
455 | if(!p_igetw(&s_version,f)) |
| 21154 | ✗ | return qe_invalid; | |
| 21155 | 455 | FFCore.quest_format[vInitData] = s_version; | |
| 21156 | |||
| 21157 |
2/4✓ Branch 0 taken 455 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 455 times.
✗ Branch 3 not taken.
|
455 | if(!read_deprecated_section_cversion(f)) |
| 21158 | ✗ | return qe_invalid; | |
| 21159 | |||
| 21160 | //section size | ||
| 21161 |
2/4✓ Branch 0 taken 455 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 455 times.
✗ Branch 3 not taken.
|
455 | if(!p_igetl(&dummy,f)) |
| 21162 | ✗ | return qe_invalid; | |
| 21163 | 455 | } | |
| 21164 | |||
| 21165 |
2/2✓ Branch 0 taken 298 times.
✓ Branch 1 taken 180 times.
|
478 | if(s_version < 37) |
| 21166 | { | ||
| 21167 |
2/4✓ Branch 0 taken 298 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 298 times.
|
298 | if(auto ret = readinitdata_old(f,Header,s_version,temp_zinit)) |
| 21168 | ✗ | return ret; | |
| 21169 | 298 | } | |
| 21170 | else | ||
| 21171 | { | ||
| 21172 | 180 | subscr_mode = ssdtMAX; | |
| 21173 |
2/2✓ Branch 0 taken 5760 times.
✓ Branch 1 taken 180 times.
|
5940 | for(int q = 0; q < MAXITEMS/8; ++q) |
| 21174 |
2/4✓ Branch 0 taken 5760 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 5760 times.
|
5760 | if(!p_getc(&temp_zinit.items[q], f)) |
| 21175 | ✗ | return qe_invalid; | |
| 21176 |
2/2✓ Branch 0 taken 134 times.
✓ Branch 1 taken 46 times.
|
180 | if(s_version >= 42) |
| 21177 | { | ||
| 21178 |
2/2✓ Branch 0 taken 68608 times.
✓ Branch 1 taken 134 times.
|
68742 | for(int q = 0; q < MAXLEVELS; ++q) |
| 21179 | { | ||
| 21180 |
2/4✓ Branch 0 taken 68608 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 68608 times.
|
68608 | if(!p_getc(&temp_zinit.litems[q], f)) |
| 21181 | ✗ | return qe_invalid; | |
| 21182 | 68608 | } | |
| 21183 | 134 | } | |
| 21184 | else | ||
| 21185 | { | ||
| 21186 | byte tmp_map[MAXLEVELS/8]; | ||
| 21187 | byte tmp_compass[MAXLEVELS/8]; | ||
| 21188 | byte tmp_boss_key[MAXLEVELS/8]; | ||
| 21189 | byte tmp_mcguffin[MAXLEVELS/8]; | ||
| 21190 |
2/2✓ Branch 0 taken 2944 times.
✓ Branch 1 taken 46 times.
|
2990 | for(int q = 0; q < MAXLEVELS/8; ++q) |
| 21191 | { | ||
| 21192 |
2/4✓ Branch 0 taken 2944 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2944 times.
✗ Branch 3 not taken.
|
2944 | if(!p_getc(&tmp_map[q], f)) |
| 21193 | ✗ | return qe_invalid; | |
| 21194 |
2/4✓ Branch 0 taken 2944 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 2944 times.
|
2944 | if(!p_getc(&tmp_compass[q], f)) |
| 21195 | ✗ | return qe_invalid; | |
| 21196 |
2/4✓ Branch 0 taken 2944 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 2944 times.
|
2944 | if(!p_getc(&tmp_boss_key[q], f)) |
| 21197 | ✗ | return qe_invalid; | |
| 21198 |
2/4✓ Branch 0 taken 2944 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2944 times.
✗ Branch 3 not taken.
|
2944 | if(!p_getc(&tmp_mcguffin[q], f)) |
| 21199 | ✗ | return qe_invalid; | |
| 21200 | 2944 | } | |
| 21201 |
2/2✓ Branch 0 taken 23552 times.
✓ Branch 1 taken 46 times.
|
23598 | for(int q = 0; q < MAXLEVELS; ++q) |
| 21202 | { | ||
| 21203 |
2/4✓ Branch 0 taken 23552 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 23552 times.
|
23552 | SETFLAG(temp_zinit.litems[q], liMAP, get_bit(tmp_map, q)); |
| 21204 |
3/4✓ Branch 0 taken 23552 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 20 times.
✓ Branch 3 taken 23532 times.
|
23552 | SETFLAG(temp_zinit.litems[q], liCOMPASS, get_bit(tmp_compass, q)); |
| 21205 |
2/4✓ Branch 0 taken 23552 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 23552 times.
|
23552 | SETFLAG(temp_zinit.litems[q], liBOSSKEY, get_bit(tmp_boss_key, q)); |
| 21206 |
3/4✓ Branch 0 taken 23552 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 144 times.
✓ Branch 3 taken 23408 times.
|
23552 | SETFLAG(temp_zinit.litems[q], liTRIFORCE, get_bit(tmp_mcguffin, q)); |
| 21207 | 23552 | } | |
| 21208 | } | ||
| 21209 |
2/4✓ Branch 0 taken 180 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 180 times.
✗ Branch 3 not taken.
|
180 | if(!p_getbvec(&temp_zinit.level_keys, f)) |
| 21210 | ✗ | return qe_invalid; | |
| 21211 | byte num_counters; | ||
| 21212 |
2/4✓ Branch 0 taken 180 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 180 times.
✗ Branch 3 not taken.
|
180 | if(!p_getc(&num_counters,f)) |
| 21213 | ✗ | return qe_invalid; | |
| 21214 |
2/2✓ Branch 0 taken 19260 times.
✓ Branch 1 taken 180 times.
|
19440 | for(int q = 0; q < num_counters; ++q) |
| 21215 |
2/4✓ Branch 0 taken 19260 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 19260 times.
|
19260 | if(!p_igetw(&temp_zinit.counter[q],f)) |
| 21216 | ✗ | return qe_invalid; | |
| 21217 |
2/2✓ Branch 0 taken 180 times.
✓ Branch 1 taken 19260 times.
|
19440 | for(int q = 0; q < num_counters; ++q) |
| 21218 |
2/4✓ Branch 0 taken 19260 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 19260 times.
|
19260 | if(!p_igetw(&temp_zinit.mcounter[q],f)) |
| 21219 | ✗ | return qe_invalid; | |
| 21220 |
2/4✓ Branch 0 taken 180 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 180 times.
✗ Branch 3 not taken.
|
180 | if(!p_getc(&temp_zinit.bomb_ratio,f)) |
| 21221 | ✗ | return qe_invalid; | |
| 21222 |
2/4✓ Branch 0 taken 180 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 180 times.
✗ Branch 3 not taken.
|
180 | if(!p_getc(&temp_zinit.hcp,f)) |
| 21223 | ✗ | return qe_invalid; | |
| 21224 |
2/4✓ Branch 0 taken 180 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 180 times.
✗ Branch 3 not taken.
|
180 | if(!p_getc(&temp_zinit.hcp_per_hc,f)) |
| 21225 | ✗ | return qe_invalid; | |
| 21226 |
2/4✓ Branch 0 taken 180 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 180 times.
✗ Branch 3 not taken.
|
180 | if(!p_igetw(&temp_zinit.cont_heart,f)) |
| 21227 | ✗ | return qe_invalid; | |
| 21228 |
2/4✓ Branch 0 taken 180 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 180 times.
✗ Branch 3 not taken.
|
180 | if(!p_getc(&temp_zinit.hp_per_heart,f)) |
| 21229 | ✗ | return qe_invalid; | |
| 21230 |
2/4✓ Branch 0 taken 180 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 180 times.
✗ Branch 3 not taken.
|
180 | if(!p_getc(&temp_zinit.magic_per_block,f)) |
| 21231 | ✗ | return qe_invalid; | |
| 21232 |
2/4✓ Branch 0 taken 180 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 180 times.
✗ Branch 3 not taken.
|
180 | if(!p_getc(&temp_zinit.hero_damage_multiplier,f)) |
| 21233 | ✗ | return qe_invalid; | |
| 21234 |
2/4✓ Branch 0 taken 180 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 180 times.
✗ Branch 3 not taken.
|
180 | if(!p_getc(&temp_zinit.ene_damage_multiplier,f)) |
| 21235 | ✗ | return qe_invalid; | |
| 21236 |
2/4✓ Branch 0 taken 180 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 180 times.
✗ Branch 3 not taken.
|
180 | if(!p_getc(&temp_zinit.dither_type,f)) |
| 21237 | ✗ | return qe_invalid; | |
| 21238 |
2/4✓ Branch 0 taken 180 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 180 times.
✗ Branch 3 not taken.
|
180 | if(!p_getc(&temp_zinit.dither_arg,f)) |
| 21239 | ✗ | return qe_invalid; | |
| 21240 |
2/4✓ Branch 0 taken 180 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 180 times.
✗ Branch 3 not taken.
|
180 | if(!p_getc(&temp_zinit.dither_percent,f)) |
| 21241 | ✗ | return qe_invalid; | |
| 21242 |
2/4✓ Branch 0 taken 180 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 180 times.
✗ Branch 3 not taken.
|
180 | if(!p_getc(&temp_zinit.def_lightrad,f)) |
| 21243 | ✗ | return qe_invalid; | |
| 21244 |
2/4✓ Branch 0 taken 180 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 180 times.
✗ Branch 3 not taken.
|
180 | if(!p_getc(&temp_zinit.transdark_percent,f)) |
| 21245 | ✗ | return qe_invalid; | |
| 21246 |
2/4✓ Branch 0 taken 180 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 180 times.
✗ Branch 3 not taken.
|
180 | if(!p_getc(&temp_zinit.darkcol,f)) |
| 21247 | ✗ | return qe_invalid; | |
| 21248 |
2/4✓ Branch 0 taken 180 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 180 times.
✗ Branch 3 not taken.
|
180 | if(!p_igetl(&temp_zinit.ss_grid_x,f)) |
| 21249 | ✗ | return qe_invalid; | |
| 21250 |
2/4✓ Branch 0 taken 180 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 180 times.
✗ Branch 3 not taken.
|
180 | if(!p_igetl(&temp_zinit.ss_grid_y,f)) |
| 21251 | ✗ | return qe_invalid; | |
| 21252 |
2/4✓ Branch 0 taken 180 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 180 times.
✗ Branch 3 not taken.
|
180 | if(!p_igetl(&temp_zinit.ss_grid_xofs,f)) |
| 21253 | ✗ | return qe_invalid; | |
| 21254 |
2/4✓ Branch 0 taken 180 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 180 times.
|
180 | if(!p_igetl(&temp_zinit.ss_grid_yofs,f)) |
| 21255 | ✗ | return qe_invalid; | |
| 21256 |
2/4✓ Branch 0 taken 180 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 180 times.
✗ Branch 3 not taken.
|
180 | if(!p_igetl(&temp_zinit.ss_grid_color,f)) |
| 21257 | ✗ | return qe_invalid; | |
| 21258 |
2/4✓ Branch 0 taken 180 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 180 times.
✗ Branch 3 not taken.
|
180 | if(!p_igetl(&temp_zinit.ss_bbox_1_color,f)) |
| 21259 | ✗ | return qe_invalid; | |
| 21260 |
2/4✓ Branch 0 taken 180 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 180 times.
✗ Branch 3 not taken.
|
180 | if(!p_igetl(&temp_zinit.ss_bbox_2_color,f)) |
| 21261 | ✗ | return qe_invalid; | |
| 21262 |
2/4✓ Branch 0 taken 180 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 180 times.
✗ Branch 3 not taken.
|
180 | if(!p_igetl(&temp_zinit.ss_flags,f)) |
| 21263 | ✗ | return qe_invalid; | |
| 21264 |
2/4✓ Branch 0 taken 180 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 180 times.
✗ Branch 3 not taken.
|
180 | if(!p_getbitstr(&temp_zinit.flags,f)) |
| 21265 | ✗ | return qe_invalid; | |
| 21266 |
2/4✓ Branch 0 taken 180 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 180 times.
✗ Branch 3 not taken.
|
180 | if(!p_getc(&temp_zinit.last_map,f)) |
| 21267 | ✗ | return qe_invalid; | |
| 21268 |
2/4✓ Branch 0 taken 180 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 180 times.
✗ Branch 3 not taken.
|
180 | if(!p_getc(&temp_zinit.last_screen,f)) |
| 21269 | ✗ | return qe_invalid; | |
| 21270 |
2/4✓ Branch 0 taken 180 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 180 times.
✗ Branch 3 not taken.
|
180 | if(!p_getc(&temp_zinit.msg_more_x,f)) |
| 21271 | ✗ | return qe_invalid; | |
| 21272 |
2/4✓ Branch 0 taken 180 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 180 times.
✗ Branch 3 not taken.
|
180 | if(!p_getc(&temp_zinit.msg_more_y,f)) |
| 21273 | ✗ | return qe_invalid; | |
| 21274 |
2/4✓ Branch 0 taken 180 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 180 times.
✗ Branch 3 not taken.
|
180 | if(!p_getc(&temp_zinit.msg_more_is_offset,f)) |
| 21275 | ✗ | return qe_invalid; | |
| 21276 |
2/4✓ Branch 0 taken 180 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 180 times.
✗ Branch 3 not taken.
|
180 | if(!p_getc(&temp_zinit.msg_speed,f)) |
| 21277 | ✗ | return qe_invalid; | |
| 21278 |
2/4✓ Branch 0 taken 180 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 180 times.
✗ Branch 3 not taken.
|
180 | if(!p_igetl(&temp_zinit.gravity,f)) |
| 21279 | ✗ | return qe_invalid; | |
| 21280 |
2/4✓ Branch 0 taken 180 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 180 times.
✗ Branch 3 not taken.
|
180 | if(!p_igetl(&temp_zinit.swimgravity,f)) |
| 21281 | ✗ | return qe_invalid; | |
| 21282 |
2/4✓ Branch 0 taken 180 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 180 times.
✗ Branch 3 not taken.
|
180 | if(!p_igetw(&temp_zinit.terminalv,f)) |
| 21283 | ✗ | return qe_invalid; | |
| 21284 |
2/4✓ Branch 0 taken 180 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 180 times.
✗ Branch 3 not taken.
|
180 | if(!p_getc(&temp_zinit.hero_swim_speed,f)) |
| 21285 | ✗ | return qe_invalid; | |
| 21286 |
2/4✓ Branch 0 taken 180 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 180 times.
✗ Branch 3 not taken.
|
180 | if(!p_getc(&temp_zinit.hero_swim_mult,f)) |
| 21287 | ✗ | return qe_invalid; | |
| 21288 |
2/4✓ Branch 0 taken 180 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 180 times.
✗ Branch 3 not taken.
|
180 | if(!p_getc(&temp_zinit.hero_swim_div,f)) |
| 21289 | ✗ | return qe_invalid; | |
| 21290 |
2/4✓ Branch 0 taken 180 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 180 times.
✗ Branch 3 not taken.
|
180 | if(!p_igetw(&temp_zinit.heroSideswimUpStep,f)) |
| 21291 | ✗ | return qe_invalid; | |
| 21292 |
2/4✓ Branch 0 taken 180 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 180 times.
✗ Branch 3 not taken.
|
180 | if(!p_igetw(&temp_zinit.heroSideswimSideStep,f)) |
| 21293 | ✗ | return qe_invalid; | |
| 21294 |
2/4✓ Branch 0 taken 180 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 180 times.
✗ Branch 3 not taken.
|
180 | if(!p_igetw(&temp_zinit.heroSideswimDownStep,f)) |
| 21295 | ✗ | return qe_invalid; | |
| 21296 |
2/4✓ Branch 0 taken 180 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 180 times.
✗ Branch 3 not taken.
|
180 | if(!p_igetl(&temp_zinit.exitWaterJump,f)) |
| 21297 | ✗ | return qe_invalid; | |
| 21298 |
2/4✓ Branch 0 taken 180 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 180 times.
✗ Branch 3 not taken.
|
180 | if(!p_igetw(&temp_zinit.heroStep,f)) |
| 21299 | ✗ | return qe_invalid; | |
| 21300 |
2/4✓ Branch 0 taken 180 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 180 times.
✗ Branch 3 not taken.
|
180 | if(!p_getc(&temp_zinit.heroAnimationStyle,f)) |
| 21301 | ✗ | return qe_invalid; | |
| 21302 |
2/4✓ Branch 0 taken 180 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 180 times.
✗ Branch 3 not taken.
|
180 | if(!p_getc(&temp_zinit.jump_hero_layer_threshold,f)) |
| 21303 | ✗ | return qe_invalid; | |
| 21304 |
2/4✓ Branch 0 taken 180 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 180 times.
✗ Branch 3 not taken.
|
180 | if(!p_igetl(&temp_zinit.bunny_ltm,f)) |
| 21305 | ✗ | return qe_invalid; | |
| 21306 |
2/4✓ Branch 0 taken 180 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 180 times.
✗ Branch 3 not taken.
|
180 | if(!p_igetw(&temp_zinit.start_dmap,f)) |
| 21307 | ✗ | return qe_invalid; | |
| 21308 |
2/4✓ Branch 0 taken 180 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 180 times.
✗ Branch 3 not taken.
|
180 | if(!p_igetw(&temp_zinit.subscrSpeed,f)) |
| 21309 | ✗ | return qe_invalid; | |
| 21310 |
2/4✓ Branch 0 taken 180 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 180 times.
✗ Branch 3 not taken.
|
180 | if(!p_getc(&temp_zinit.switchhookstyle,f)) |
| 21311 | ✗ | return qe_invalid; | |
| 21312 |
2/4✓ Branch 0 taken 180 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 180 times.
✗ Branch 3 not taken.
|
180 | if(!p_getc(&temp_zinit.magicdrainrate,f)) |
| 21313 | ✗ | return qe_invalid; | |
| 21314 |
2/4✓ Branch 0 taken 180 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 180 times.
✗ Branch 3 not taken.
|
180 | if(!p_igetzf(&temp_zinit.shove_offset,f)) |
| 21315 | ✗ | return qe_invalid; | |
| 21316 |
2/4✓ Branch 0 taken 180 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 180 times.
✗ Branch 3 not taken.
|
180 | if(!p_getbitstr(&temp_zinit.gen_doscript, f)) |
| 21317 | ✗ | return qe_invalid; | |
| 21318 |
2/4✓ Branch 0 taken 180 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 180 times.
✗ Branch 3 not taken.
|
180 | if(!p_getbmap(&temp_zinit.gen_exitState, f)) |
| 21319 | ✗ | return qe_invalid; | |
| 21320 |
2/4✓ Branch 0 taken 180 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 180 times.
✗ Branch 3 not taken.
|
180 | if(!p_getbmap(&temp_zinit.gen_reloadState, f)) |
| 21321 | ✗ | return qe_invalid; | |
| 21322 |
2/4✓ Branch 0 taken 180 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 180 times.
|
180 | if(!p_getbmap(&temp_zinit.gen_initd, f)) |
| 21323 | ✗ | return qe_invalid; | |
| 21324 |
2/4✓ Branch 0 taken 180 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 180 times.
✗ Branch 3 not taken.
|
180 | if(!p_getbmap(&temp_zinit.gen_eventstate, f)) |
| 21325 | ✗ | return qe_invalid; | |
| 21326 |
2/4✓ Branch 0 taken 180 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 180 times.
✗ Branch 3 not taken.
|
180 | if(!p_getbmap(&temp_zinit.gen_data, f)) |
| 21327 | ✗ | return qe_invalid; | |
| 21328 |
2/4✓ Branch 0 taken 180 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 180 times.
✗ Branch 3 not taken.
|
180 | if(!p_getbmap(&temp_zinit.screen_data, f)) |
| 21329 | ✗ | return qe_invalid; | |
| 21330 |
1/2✓ Branch 0 taken 180 times.
✗ Branch 1 not taken.
|
180 | if (s_version >= 38) |
| 21331 | { | ||
| 21332 |
2/4✓ Branch 0 taken 180 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 180 times.
✗ Branch 3 not taken.
|
180 | if (!p_getc(&temp_zinit.spriteflickerspeed, f)) |
| 21333 | ✗ | return qe_invalid; | |
| 21334 |
2/4✓ Branch 0 taken 180 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 180 times.
✗ Branch 3 not taken.
|
180 | if (!p_getc(&temp_zinit.spriteflickercolor, f)) |
| 21335 | ✗ | return qe_invalid; | |
| 21336 |
2/4✓ Branch 0 taken 180 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 180 times.
✗ Branch 3 not taken.
|
180 | if (!p_getc(&temp_zinit.spriteflickertransp, f)) |
| 21337 | ✗ | return qe_invalid; | |
| 21338 | 180 | } | |
| 21339 |
2/2✓ Branch 0 taken 152 times.
✓ Branch 1 taken 28 times.
|
180 | if(s_version >= 39) |
| 21340 |
2/4✓ Branch 0 taken 152 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 152 times.
✗ Branch 3 not taken.
|
152 | if(!p_igetzf(&temp_zinit.air_drag, f)) |
| 21341 | ✗ | return qe_invalid; | |
| 21342 | |||
| 21343 | // TODO: this first branch can likely be removed, as it only fixes an issues | ||
| 21344 | // that existed for a handful of temporary z3 builds (and active users of that | ||
| 21345 | // fork would have been updating often, beyond s_version 40). | ||
| 21346 |
3/4✓ Branch 0 taken 152 times.
✓ Branch 1 taken 28 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 152 times.
|
180 | if (Header->is_z3 && s_version == 40) |
| 21347 | { | ||
| 21348 | ✗ | if(!p_getc(&temp_zinit.region_mapping, f)) | |
| 21349 | ✗ | return qe_invalid; | |
| 21350 | ✗ | } | |
| 21351 | else | ||
| 21352 | { | ||
| 21353 |
2/2✓ Branch 0 taken 152 times.
✓ Branch 1 taken 28 times.
|
180 | if(s_version >= 40) |
| 21354 | { | ||
| 21355 |
2/4✓ Branch 0 taken 152 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 152 times.
✗ Branch 3 not taken.
|
152 | if(!p_igetw(&temp_zinit.light_wave_rate, f)) |
| 21356 | ✗ | return qe_invalid; | |
| 21357 |
2/4✓ Branch 0 taken 152 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 152 times.
✗ Branch 3 not taken.
|
152 | if(!p_igetw(&temp_zinit.light_wave_size, f)) |
| 21358 | ✗ | return qe_invalid; | |
| 21359 | 152 | } | |
| 21360 | |||
| 21361 |
2/2✓ Branch 0 taken 152 times.
✓ Branch 1 taken 28 times.
|
180 | if(s_version >= 41) |
| 21362 | { | ||
| 21363 |
2/4✓ Branch 0 taken 152 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 152 times.
✗ Branch 3 not taken.
|
152 | if(!p_getc(&temp_zinit.region_mapping, f)) |
| 21364 | ✗ | return qe_invalid; | |
| 21365 | 152 | } | |
| 21366 | } | ||
| 21367 | } | ||
| 21368 |
2/2✓ Branch 0 taken 351 times.
✓ Branch 1 taken 127 times.
|
478 | if(s_version >= 43) |
| 21369 |
2/2✓ Branch 0 taken 32512 times.
✓ Branch 1 taken 127 times.
|
32639 | for(uint q = 0; q < NUM_BOTTLE_SLOTS; ++q) |
| 21370 |
2/4✓ Branch 0 taken 32512 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 32512 times.
|
32512 | if (!p_getc(&temp_zinit.bottle_slot[q], f)) |
| 21371 | 127 | return qe_invalid; | |
| 21372 |
1/2✓ Branch 0 taken 478 times.
✗ Branch 1 not taken.
|
478 | if (should_skip) |
| 21373 | ✗ | return 0; | |
| 21374 | |||
| 21375 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 478 times.
|
478 | if(loading_tileset_flags & TILESET_CLEARMAPS) |
| 21376 | { | ||
| 21377 | ✗ | temp_zinit.last_map = 0; | |
| 21378 | ✗ | temp_zinit.last_screen = 0; | |
| 21379 | ✗ | temp_zinit.screen_data.clear(); | |
| 21380 | ✗ | } | |
| 21381 |
1/2✓ Branch 0 taken 478 times.
✗ Branch 1 not taken.
|
478 | temp_zinit.normalize(); |
| 21382 |
1/2✓ Branch 0 taken 478 times.
✗ Branch 1 not taken.
|
478 | zinit = temp_zinit; |
| 21383 | |||
| 21384 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 478 times.
|
478 | if(zinit.heroAnimationStyle==las_zelda3slow) |
| 21385 | { | ||
| 21386 | ✗ | hero_animation_speed=2; | |
| 21387 | ✗ | } | |
| 21388 | else | ||
| 21389 | { | ||
| 21390 | 478 | hero_animation_speed=1; | |
| 21391 | } | ||
| 21392 | |||
| 21393 | 478 | return 0; | |
| 21394 | 478 | } | |
| 21395 | |||
| 21396 | /* | ||
| 21397 | void setupitemdropsets() | ||
| 21398 | { | ||
| 21399 | for(int32_t i=0; i<isMAX; i++) | ||
| 21400 | { | ||
| 21401 | memcpy(&item_drop_sets[i], &default_item_drop_sets[i], sizeof(item_drop_object)); | ||
| 21402 | } | ||
| 21403 | } | ||
| 21404 | */ | ||
| 21405 | |||
| 21406 | 419 | int32_t readitemdropsets(PACKFILE *f, int32_t version) | |
| 21407 | { | ||
| 21408 |
2/2✓ Branch 0 taken 396 times.
✓ Branch 1 taken 23 times.
|
419 | bool should_skip = legacy_skip_flags && get_bit(legacy_skip_flags, skip_itemdropsets); |
| 21409 | |||
| 21410 | dword dummy_dword; | ||
| 21411 | 419 | word item_drop_sets_to_read=0; | |
| 21412 | item_drop_object tempitemdrop; | ||
| 21413 | 419 | word s_version=0; | |
| 21414 | |||
| 21415 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 419 times.
|
419 | if (!should_skip) |
| 21416 |
2/2✓ Branch 0 taken 107264 times.
✓ Branch 1 taken 419 times.
|
107683 | for(int32_t i=0; i<MAXITEMDROPSETS; i++) |
| 21417 | { | ||
| 21418 | 107264 | memset(&item_drop_sets[i], 0, sizeof(item_drop_object)); | |
| 21419 | 107683 | } | |
| 21420 | |||
| 21421 |
2/2✓ Branch 0 taken 396 times.
✓ Branch 1 taken 23 times.
|
419 | if(version > 0x192) |
| 21422 | { | ||
| 21423 | 396 | item_drop_sets_to_read=0; | |
| 21424 | |||
| 21425 | //section version info | ||
| 21426 |
1/2✓ Branch 0 taken 396 times.
✗ Branch 1 not taken.
|
396 | if(!p_igetw(&s_version,f)) |
| 21427 | { | ||
| 21428 | ✗ | return qe_invalid; | |
| 21429 | } | ||
| 21430 | |||
| 21431 | 396 | FFCore.quest_format[vItemDropsets] = s_version; | |
| 21432 | |||
| 21433 |
1/2✓ Branch 0 taken 396 times.
✗ Branch 1 not taken.
|
396 | if(!read_deprecated_section_cversion(f)) |
| 21434 | { | ||
| 21435 | ✗ | return qe_invalid; | |
| 21436 | } | ||
| 21437 | |||
| 21438 | //section size | ||
| 21439 |
1/2✓ Branch 0 taken 396 times.
✗ Branch 1 not taken.
|
396 | if(!p_igetl(&dummy_dword,f)) |
| 21440 | { | ||
| 21441 | ✗ | return qe_invalid; | |
| 21442 | } | ||
| 21443 | |||
| 21444 | //finally... section data | ||
| 21445 |
1/2✓ Branch 0 taken 396 times.
✗ Branch 1 not taken.
|
396 | if(!p_igetw(&item_drop_sets_to_read,f)) |
| 21446 | { | ||
| 21447 | ✗ | return qe_invalid; | |
| 21448 | } | ||
| 21449 | |||
| 21450 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 396 times.
|
396 | if (item_drop_sets_to_read > MAXITEMDROPSETS) |
| 21451 | { | ||
| 21452 | ✗ | return qe_invalid; | |
| 21453 | } | ||
| 21454 | 396 | } | |
| 21455 | else | ||
| 21456 | { | ||
| 21457 | 23 | init_item_drop_sets(); | |
| 21458 | } | ||
| 21459 | |||
| 21460 |
2/2✓ Branch 0 taken 23 times.
✓ Branch 1 taken 396 times.
|
419 | if(s_version>=1) |
| 21461 | { | ||
| 21462 |
2/2✓ Branch 0 taken 5981 times.
✓ Branch 1 taken 396 times.
|
6377 | for(int32_t i=0; i<item_drop_sets_to_read; i++) |
| 21463 | { | ||
| 21464 |
1/2✓ Branch 0 taken 5981 times.
✗ Branch 1 not taken.
|
5981 | if(!p_getstr(tempitemdrop.name,sizeof(tempitemdrop.name)-1,f)) |
| 21465 | { | ||
| 21466 | ✗ | return qe_invalid; | |
| 21467 | } | ||
| 21468 | |||
| 21469 |
2/2✓ Branch 0 taken 59810 times.
✓ Branch 1 taken 5981 times.
|
65791 | for(int32_t j=0; j<10; ++j) |
| 21470 | { | ||
| 21471 |
1/2✓ Branch 0 taken 59810 times.
✗ Branch 1 not taken.
|
59810 | if(!p_igetw(&tempitemdrop.item[j],f)) |
| 21472 | { | ||
| 21473 | ✗ | return qe_invalid; | |
| 21474 | } | ||
| 21475 | 59810 | } | |
| 21476 | |||
| 21477 |
2/2✓ Branch 0 taken 65791 times.
✓ Branch 1 taken 5981 times.
|
71772 | for(int32_t j=0; j<11; ++j) |
| 21478 | { | ||
| 21479 |
1/2✓ Branch 0 taken 65791 times.
✗ Branch 1 not taken.
|
65791 | if(!p_igetw(&tempitemdrop.chance[j],f)) |
| 21480 | { | ||
| 21481 | ✗ | return qe_invalid; | |
| 21482 | } | ||
| 21483 | 65791 | } | |
| 21484 | |||
| 21485 | // Dec 2008: Addition of the 'Tall Grass' set, #12, | ||
| 21486 | // overrides the quest's set #12. | ||
| 21487 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 5981 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
5981 | if(s_version<2 && i==12) |
| 21488 | ✗ | continue; | |
| 21489 | |||
| 21490 | // Deprecated: qr_NOCLOCKS and qr_ALLOW10RUPEEDROPS | ||
| 21491 |
1/4✓ Branch 0 taken 5981 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
5981 | if(s_version<2) for(int32_t j=0; j<10; ++j) |
| 21492 | { | ||
| 21493 | ✗ | int32_t it = tempitemdrop.item[j]; | |
| 21494 | |||
| 21495 | ✗ | if((itemsbuf[it].family == itype_rupee | |
| 21496 | ✗ | && ((itemsbuf[it].amount)&0xFFF) == 10) | |
| 21497 | ✗ | && !get_bit(deprecated_rules, qr_ALLOW10RUPEEDROPS_DEP)) | |
| 21498 | { | ||
| 21499 | ✗ | tempitemdrop.chance[j+1]=0; | |
| 21500 | ✗ | } | |
| 21501 | ✗ | else if(itemsbuf[it].family == itype_clock && get_bit(deprecated_rules, qr_NOCLOCKS_DEP)) | |
| 21502 | { | ||
| 21503 | ✗ | tempitemdrop.chance[j+1]=0; | |
| 21504 | ✗ | } | |
| 21505 | |||
| 21506 | // From Sept 2007 to Dec 2008, non-gameplay items were prohibited. | ||
| 21507 | ✗ | if(itemsbuf[it].family == itype_misc) | |
| 21508 | { | ||
| 21509 | // If a non-gameplay item was selected, then item drop was aborted. | ||
| 21510 | // Reflect this by increasing the 'Nothing' chance accordingly. | ||
| 21511 | ✗ | tempitemdrop.chance[0]+=tempitemdrop.chance[j+1]; | |
| 21512 | ✗ | tempitemdrop.chance[j+1]=0; | |
| 21513 | ✗ | } | |
| 21514 | ✗ | } | |
| 21515 | |||
| 21516 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 5981 times.
|
5981 | if (!should_skip) |
| 21517 | 5981 | memcpy(&item_drop_sets[i], &tempitemdrop, sizeof(item_drop_object)); | |
| 21518 | 5981 | } | |
| 21519 | 396 | } | |
| 21520 | |||
| 21521 | 419 | return 0; | |
| 21522 | 419 | } | |
| 21523 | |||
| 21524 | 396 | int32_t readfavorites(PACKFILE *f, int32_t) | |
| 21525 | { | ||
| 21526 |
1/2✓ Branch 0 taken 396 times.
✗ Branch 1 not taken.
|
396 | bool should_skip = legacy_skip_flags && get_bit(legacy_skip_flags, skip_favorites); |
| 21527 | |||
| 21528 | int32_t temp_num; | ||
| 21529 | dword dummy_dword; | ||
| 21530 | word num_favorite_combos; | ||
| 21531 | word num_favorite_combo_aliases; | ||
| 21532 | 396 | word s_version=0; | |
| 21533 | |||
| 21534 | //section version info | ||
| 21535 |
1/2✓ Branch 0 taken 396 times.
✗ Branch 1 not taken.
|
396 | if(!p_igetw(&s_version,f)) |
| 21536 | { | ||
| 21537 | ✗ | return qe_invalid; | |
| 21538 | } | ||
| 21539 | |||
| 21540 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 396 times.
|
396 | if (!should_skip) |
| 21541 | 396 | FFCore.quest_format[vFavourites] = s_version; | |
| 21542 | |||
| 21543 |
1/2✓ Branch 0 taken 396 times.
✗ Branch 1 not taken.
|
396 | if(!read_deprecated_section_cversion(f)) |
| 21544 | { | ||
| 21545 | ✗ | return qe_invalid; | |
| 21546 | } | ||
| 21547 | |||
| 21548 | //section size | ||
| 21549 |
1/2✓ Branch 0 taken 396 times.
✗ Branch 1 not taken.
|
396 | if(!p_igetl(&dummy_dword,f)) |
| 21550 | { | ||
| 21551 | ✗ | return qe_invalid; | |
| 21552 | } | ||
| 21553 | |||
| 21554 | 396 | word per_row = FAVORITECOMBO_PER_ROW; | |
| 21555 | 396 | word per_page = FAVORITECOMBO_PER_PAGE; | |
| 21556 |
2/2✓ Branch 0 taken 210 times.
✓ Branch 1 taken 186 times.
|
396 | if(s_version >= 3) |
| 21557 |
1/2✓ Branch 0 taken 186 times.
✗ Branch 1 not taken.
|
186 | if(!p_igetw(&per_row,f)) |
| 21558 | ✗ | return qe_invalid; | |
| 21559 |
2/2✓ Branch 0 taken 216 times.
✓ Branch 1 taken 180 times.
|
396 | if(s_version >= 4) |
| 21560 |
1/2✓ Branch 0 taken 180 times.
✗ Branch 1 not taken.
|
180 | if(!p_igetw(&per_page,f)) |
| 21561 | ✗ | return qe_invalid; | |
| 21562 | //finally... section data | ||
| 21563 |
1/2✓ Branch 0 taken 396 times.
✗ Branch 1 not taken.
|
396 | if(!p_igetw(&num_favorite_combos,f)) |
| 21564 | { | ||
| 21565 | ✗ | return qe_invalid; | |
| 21566 | } | ||
| 21567 | |||
| 21568 | //Hack; port old favorite combos | ||
| 21569 |
3/4✓ Branch 0 taken 210 times.
✓ Branch 1 taken 186 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 210 times.
|
396 | if(s_version < 3 && num_favorite_combos == 100) |
| 21570 | 210 | per_row = 13; | |
| 21571 | |||
| 21572 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 396 times.
|
396 | if (!should_skip) |
| 21573 |
2/2✓ Branch 0 taken 498960 times.
✓ Branch 1 taken 396 times.
|
499356 | for(int q = 0; q < MAXFAVORITECOMBOS; ++q) |
| 21574 | 499356 | favorite_combos[q] = -1; | |
| 21575 | 396 | byte favtype = 0; | |
| 21576 |
2/2✓ Branch 0 taken 27610 times.
✓ Branch 1 taken 396 times.
|
28006 | for(int32_t i=0; i<num_favorite_combos; i++) |
| 21577 | { | ||
| 21578 |
2/2✓ Branch 0 taken 6604 times.
✓ Branch 1 taken 21006 times.
|
27610 | if (s_version >= 4) |
| 21579 | { | ||
| 21580 |
1/2✓ Branch 0 taken 6604 times.
✗ Branch 1 not taken.
|
6604 | if (!p_getc(&favtype, f)) |
| 21581 | { | ||
| 21582 | ✗ | return qe_invalid; | |
| 21583 | } | ||
| 21584 | 6604 | } | |
| 21585 | else | ||
| 21586 | 21006 | favtype = 0; | |
| 21587 |
1/2✓ Branch 0 taken 27610 times.
✗ Branch 1 not taken.
|
27610 | if(!p_igetl(&temp_num,f)) |
| 21588 | { | ||
| 21589 | ✗ | return qe_invalid; | |
| 21590 | } | ||
| 21591 | |||
| 21592 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 27610 times.
|
27610 | if (should_skip) |
| 21593 | ✗ | continue; | |
| 21594 | |||
| 21595 |
2/2✓ Branch 0 taken 6604 times.
✓ Branch 1 taken 21006 times.
|
27610 | if(per_row == FAVORITECOMBO_PER_ROW) |
| 21596 | { | ||
| 21597 | 6604 | favorite_combos[i] = temp_num; | |
| 21598 | 6604 | favorite_combo_modes[i] = favtype; | |
| 21599 | 6604 | } | |
| 21600 | else | ||
| 21601 | { | ||
| 21602 | 21006 | int new_i = (i%per_row) + (i/per_row)*FAVORITECOMBO_PER_ROW; | |
| 21603 | 21006 | favorite_combos[new_i]=temp_num; | |
| 21604 | 21006 | favorite_combo_modes[new_i] = favtype; | |
| 21605 | } | ||
| 21606 | 27610 | } | |
| 21607 | |||
| 21608 | // Discard the separate favorite aliases list from previous versions | ||
| 21609 |
2/2✓ Branch 0 taken 180 times.
✓ Branch 1 taken 216 times.
|
396 | if(s_version<4) |
| 21610 | { | ||
| 21611 |
1/2✓ Branch 0 taken 216 times.
✗ Branch 1 not taken.
|
216 | if (!p_igetw(&num_favorite_combo_aliases, f)) |
| 21612 | { | ||
| 21613 | ✗ | return qe_invalid; | |
| 21614 | } | ||
| 21615 | |||
| 21616 |
2/2✓ Branch 0 taken 21000 times.
✓ Branch 1 taken 216 times.
|
21216 | for (int32_t i = 0; i < num_favorite_combo_aliases; i++) |
| 21617 | { | ||
| 21618 |
1/2✓ Branch 0 taken 21000 times.
✗ Branch 1 not taken.
|
21000 | if (!p_igetl(&temp_num, f)) |
| 21619 | { | ||
| 21620 | ✗ | return qe_invalid; | |
| 21621 | } | ||
| 21622 | 21000 | } | |
| 21623 | 216 | } | |
| 21624 | |||
| 21625 | 396 | word max_combo_cols = 0; | |
| 21626 | 396 | word max_mappages = 0; | |
| 21627 |
2/2✓ Branch 0 taken 210 times.
✓ Branch 1 taken 186 times.
|
396 | if(s_version >= 2) |
| 21628 | { | ||
| 21629 |
1/2✓ Branch 0 taken 186 times.
✗ Branch 1 not taken.
|
186 | if(!p_igetw(&max_combo_cols,f)) |
| 21630 | ✗ | return qe_invalid; | |
| 21631 | 186 | int32_t tmp = 0, tmp2 = 0, tmp3 = 0; | |
| 21632 |
2/2✓ Branch 0 taken 744 times.
✓ Branch 1 taken 186 times.
|
930 | for(int q = 0; q < max_combo_cols; ++q) |
| 21633 | { | ||
| 21634 |
1/2✓ Branch 0 taken 744 times.
✗ Branch 1 not taken.
|
744 | if(!p_igetl(&tmp,f)) |
| 21635 | ✗ | return qe_invalid; | |
| 21636 |
1/2✓ Branch 0 taken 744 times.
✗ Branch 1 not taken.
|
744 | if(!p_igetl(&tmp2,f)) |
| 21637 | ✗ | return qe_invalid; | |
| 21638 |
1/2✓ Branch 0 taken 744 times.
✗ Branch 1 not taken.
|
744 | if(!p_igetl(&tmp3,f)) |
| 21639 | ✗ | return qe_invalid; | |
| 21640 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 744 times.
|
744 | if(q < MAX_COMBO_COLS) |
| 21641 | { | ||
| 21642 | 744 | First[q] = tmp; | |
| 21643 | 744 | combo_alistpos[q] = tmp2; | |
| 21644 | 744 | combo_pool_listpos[q] = tmp3; | |
| 21645 | 744 | } | |
| 21646 | 744 | } | |
| 21647 | |||
| 21648 |
1/2✓ Branch 0 taken 186 times.
✗ Branch 1 not taken.
|
186 | if(!p_igetw(&max_mappages,f)) |
| 21649 | ✗ | return qe_invalid; | |
| 21650 |
2/2✓ Branch 0 taken 1674 times.
✓ Branch 1 taken 186 times.
|
1860 | for(int q = 0; q < max_mappages; ++q) |
| 21651 | { | ||
| 21652 |
1/2✓ Branch 0 taken 1674 times.
✗ Branch 1 not taken.
|
1674 | if(!p_igetl(&tmp,f)) |
| 21653 | ✗ | return qe_invalid; | |
| 21654 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1674 times.
|
1674 | if(!p_igetl(&tmp2,f)) |
| 21655 | ✗ | return qe_invalid; | |
| 21656 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1674 times.
|
1674 | if(q < MAX_MAPPAGE_BTNS) |
| 21657 | { | ||
| 21658 | 1674 | map_page[q].map = tmp; | |
| 21659 | 1674 | map_page[q].screen = tmp2; | |
| 21660 | 1674 | } | |
| 21661 | 1674 | } | |
| 21662 | 186 | } | |
| 21663 | |||
| 21664 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 396 times.
|
396 | if (should_skip) |
| 21665 | ✗ | return 0; | |
| 21666 | |||
| 21667 |
2/2✓ Branch 0 taken 840 times.
✓ Branch 1 taken 396 times.
|
1236 | for(int q = max_combo_cols; q < MAX_COMBO_COLS; ++q) |
| 21668 | { | ||
| 21669 | 840 | First[q] = 0; | |
| 21670 | 840 | combo_alistpos[q] = 0; | |
| 21671 | 840 | combo_pool_listpos[q] = 0; | |
| 21672 | 840 | } | |
| 21673 |
2/2✓ Branch 0 taken 1890 times.
✓ Branch 1 taken 396 times.
|
2286 | for(int q = max_mappages; q < MAX_MAPPAGE_BTNS; ++q) |
| 21674 | { | ||
| 21675 | 1890 | map_page[q].map = 0; | |
| 21676 | 1890 | map_page[q].screen = 0; | |
| 21677 | 1890 | } | |
| 21678 | |||
| 21679 | 396 | return 0; | |
| 21680 | 396 | } | |
| 21681 | |||
| 21682 | /* | ||
| 21683 | switch (ret) { | ||
| 21684 | case 0: | ||
| 21685 | break; | ||
| 21686 | |||
| 21687 | case qe_invalid: | ||
| 21688 | goto invalid; | ||
| 21689 | break; | ||
| 21690 | default: | ||
| 21691 | pack_fclose(f); | ||
| 21692 | if(!oldquest) | ||
| 21693 | delete_file(tmpfilename); | ||
| 21694 | return ret; | ||
| 21695 | break; | ||
| 21696 | } | ||
| 21697 | */ | ||
| 21698 | |||
| 21699 | const char *skip_text[skip_max]= | ||
| 21700 | { | ||
| 21701 | "skip_header", "skip_rules", "skip_strings", "skip_misc", | ||
| 21702 | "skip_tiles", "skip_combos", "skip_comboaliases", "skip_csets", | ||
| 21703 | "skip_maps", "skip_dmaps", "skip_doors", "skip_items", | ||
| 21704 | "skip_weapons", "skip_colors", "skip_icons", "skip_initdata", | ||
| 21705 | "skip_guys", "skip_herosprites", "skip_subscreens", "skip_ffscript", | ||
| 21706 | "skip_sfx", "skip_midis", "skip_cheats", "skip_itemdropsets", | ||
| 21707 | "skip_favorites" | ||
| 21708 | }; | ||
| 21709 | |||
| 21710 | |||
| 21711 | ✗ | void port250QuestRules(){ | |
| 21712 | |||
| 21713 | ✗ | portCandleRules(); //Candle | |
| 21714 | ✗ | portBombRules(); | |
| 21715 | |||
| 21716 | ✗ | } | |
| 21717 | |||
| 21718 | ✗ | void portCandleRules() | |
| 21719 | { | ||
| 21720 | ✗ | bool hurtshero = get_qr(qr_FIREPROOFHERO); | |
| 21721 | //itemdata itemsbuf; | ||
| 21722 | ✗ | for ( int32_t q = 0; q < MAXITEMS; q++ ) | |
| 21723 | { | ||
| 21724 | ✗ | if ( itemsbuf[q].family == itype_candle ) | |
| 21725 | { | ||
| 21726 | ✗ | if ( hurtshero ) itemsbuf[q].flags |= item_flag2; | |
| 21727 | ✗ | else itemsbuf[q].flags &= ~ item_flag2; | |
| 21728 | ✗ | } | |
| 21729 | ✗ | } | |
| 21730 | ✗ | } | |
| 21731 | |||
| 21732 | ✗ | void portBombRules() | |
| 21733 | { | ||
| 21734 | ✗ | bool hurtshero = get_qr(qr_OUCHBOMBS); | |
| 21735 | //itemdata itemsbuf; | ||
| 21736 | ✗ | for ( int32_t q = 0; q < MAXITEMS; q++ ) | |
| 21737 | { | ||
| 21738 | ✗ | if ( itemsbuf[q].family == itype_bomb ) | |
| 21739 | { | ||
| 21740 | ✗ | if ( hurtshero ) itemsbuf[q].flags |= item_flag2; | |
| 21741 | ✗ | else itemsbuf[q].flags &= ~ item_flag2; | |
| 21742 | ✗ | } | |
| 21743 | ✗ | } | |
| 21744 | ✗ | } | |
| 21745 | |||
| 21746 | 18501 | static int section_id_to_enum(int id) | |
| 21747 | { | ||
| 21748 |
24/27✗ Branch 0 not taken.
✓ Branch 1 taken 800 times.
✓ Branch 2 taken 800 times.
✓ Branch 3 taken 800 times.
✓ Branch 4 taken 800 times.
✓ Branch 5 taken 800 times.
✓ Branch 6 taken 717 times.
✓ Branch 7 taken 800 times.
✓ Branch 8 taken 800 times.
✓ Branch 9 taken 800 times.
✓ Branch 10 taken 800 times.
✓ Branch 11 taken 800 times.
✓ Branch 12 taken 800 times.
✓ Branch 13 taken 717 times.
✓ Branch 14 taken 717 times.
✓ Branch 15 taken 800 times.
✓ Branch 16 taken 800 times.
✓ Branch 17 taken 741 times.
✓ Branch 18 taken 717 times.
✓ Branch 19 taken 717 times.
✓ Branch 20 taken 717 times.
✓ Branch 21 taken 800 times.
✓ Branch 22 taken 800 times.
✓ Branch 23 taken 741 times.
✓ Branch 24 taken 717 times.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
|
18501 | switch (id) |
| 21749 | { | ||
| 21750 | ✗ | case ID_HEADER: return skip_header; | |
| 21751 | 800 | case ID_RULES: return skip_rules; | |
| 21752 | 800 | case ID_STRINGS: return skip_strings; | |
| 21753 | 800 | case ID_MISC: return skip_misc; | |
| 21754 | 800 | case ID_TILES: return skip_tiles; | |
| 21755 | 800 | case ID_COMBOS: return skip_combos; | |
| 21756 | 717 | case ID_COMBOALIASES: return skip_comboaliases; | |
| 21757 | 800 | case ID_CSETS: return skip_csets; | |
| 21758 | 800 | case ID_MAPS: return skip_maps; | |
| 21759 | 800 | case ID_DMAPS: return skip_dmaps; | |
| 21760 | 800 | case ID_DOORS: return skip_doors; | |
| 21761 | 800 | case ID_ITEMS: return skip_items; | |
| 21762 | 800 | case ID_WEAPONS: return skip_weapons; | |
| 21763 | 717 | case ID_COLORS: return skip_colors; | |
| 21764 | 717 | case ID_ICONS: return skip_icons; | |
| 21765 | 800 | case ID_INITDATA: return skip_initdata; | |
| 21766 | 800 | case ID_GUYS: return skip_guys; | |
| 21767 | 741 | case ID_HEROSPRITES: return skip_herosprites; | |
| 21768 | 717 | case ID_SUBSCREEN: return skip_subscreens; | |
| 21769 | 717 | case ID_FFSCRIPT: return skip_ffscript; | |
| 21770 | 717 | case ID_SFX: return skip_sfx; | |
| 21771 | 800 | case ID_MIDIS: return skip_midis; | |
| 21772 | 800 | case ID_CHEATS: return skip_cheats; | |
| 21773 | 741 | case ID_ITEMDROPSETS: return skip_itemdropsets; | |
| 21774 | 717 | case ID_FAVORITES: return skip_favorites; | |
| 21775 | ✗ | case ID_ZINFO: return skip_zinfo; | |
| 21776 | } | ||
| 21777 | |||
| 21778 | ✗ | return -1; | |
| 21779 | 18501 | } | |
| 21780 | |||
| 21781 | 18093 | static int maybe_skip_section(PACKFILE* f, dword& section_id, const byte* skip_flags) | |
| 21782 | { | ||
| 21783 | 18093 | int section_enum = section_id_to_enum(section_id); | |
| 21784 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 18093 times.
|
18093 | bool skip = section_enum >= 0 && get_bit(skip_flags, section_enum); |
| 21785 |
2/2✓ Branch 0 taken 6741 times.
✓ Branch 1 taken 11352 times.
|
18093 | if (skip) |
| 21786 | { | ||
| 21787 | word s_version; | ||
| 21788 |
1/2✓ Branch 0 taken 6741 times.
✗ Branch 1 not taken.
|
6741 | if (!p_igetw(&s_version,f)) |
| 21789 | { | ||
| 21790 | ✗ | return qe_invalid; | |
| 21791 | } | ||
| 21792 | |||
| 21793 |
1/2✓ Branch 0 taken 6741 times.
✗ Branch 1 not taken.
|
6741 | if (!read_deprecated_section_cversion(f)) |
| 21794 | { | ||
| 21795 | ✗ | return qe_invalid; | |
| 21796 | } | ||
| 21797 | |||
| 21798 |
3/4✓ Branch 0 taken 321 times.
✓ Branch 1 taken 6420 times.
✓ Branch 2 taken 321 times.
✗ Branch 3 not taken.
|
6741 | if (section_id == ID_RULES && s_version > 16) |
| 21799 | { | ||
| 21800 | dword dummy; | ||
| 21801 | ✗ | if (!p_igetl(&dummy,f)) | |
| 21802 | { | ||
| 21803 | ✗ | return qe_invalid; | |
| 21804 | } | ||
| 21805 | ✗ | } | |
| 21806 | |||
| 21807 |
3/4✓ Branch 0 taken 321 times.
✓ Branch 1 taken 6420 times.
✓ Branch 2 taken 321 times.
✗ Branch 3 not taken.
|
6741 | if (section_id == ID_FFSCRIPT && s_version >= 18) |
| 21808 | { | ||
| 21809 | word dummy; | ||
| 21810 | ✗ | if (!p_igetw(&dummy,f)) | |
| 21811 | { | ||
| 21812 | ✗ | return qe_invalid; | |
| 21813 | } | ||
| 21814 | ✗ | } | |
| 21815 | |||
| 21816 | dword section_length; | ||
| 21817 |
1/2✓ Branch 0 taken 6741 times.
✗ Branch 1 not taken.
|
6741 | if (!p_igetl(§ion_length,f)) |
| 21818 | { | ||
| 21819 | ✗ | return qe_invalid; | |
| 21820 | } | ||
| 21821 | |||
| 21822 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 6741 times.
|
6741 | if (pack_fseek(f, section_length)) |
| 21823 | { | ||
| 21824 | ✗ | return qe_invalid; | |
| 21825 | } | ||
| 21826 | |||
| 21827 |
2/2✓ Branch 0 taken 321 times.
✓ Branch 1 taken 6420 times.
|
6741 | if (!pack_feof(f)) |
| 21828 | { | ||
| 21829 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 6420 times.
|
6420 | if (!p_mgetl(§ion_id,f)) |
| 21830 | { | ||
| 21831 | ✗ | return qe_invalid; | |
| 21832 | } | ||
| 21833 | 6420 | } | |
| 21834 | |||
| 21835 | 6741 | return qe_cancel; | |
| 21836 | } | ||
| 21837 | |||
| 21838 | 11352 | return qe_OK; | |
| 21839 | 18093 | } | |
| 21840 | |||
| 21841 | // TODO: this was copied from zc/zasm_utils.cpp | ||
| 21842 | 282 | static void _zasm_for_every_script(std::function<void(zasm_script*)> fn) | |
| 21843 | { | ||
| 21844 | extern std::vector<std::shared_ptr<zasm_script>> zasm_scripts; | ||
| 21845 | |||
| 21846 | 282 | std::vector<zasm_script*> scripts; | |
| 21847 |
1/2✓ Branch 0 taken 282 times.
✗ Branch 1 not taken.
|
282 | scripts.reserve(zasm_scripts.size()); |
| 21848 |
2/2✓ Branch 0 taken 282 times.
✓ Branch 1 taken 301585 times.
|
301867 | for (auto& script : zasm_scripts) |
| 21849 |
3/4✓ Branch 0 taken 301585 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 8482 times.
✓ Branch 3 taken 293103 times.
|
301585 | if (script->valid()) |
| 21850 |
1/2✓ Branch 0 taken 8482 times.
✗ Branch 1 not taken.
|
8482 | scripts.push_back(script.get()); |
| 21851 | |||
| 21852 |
2/4✓ Branch 0 taken 282 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 282 times.
|
282 | std::for_each(scripts.begin(), scripts.end(), fn); |
| 21853 | 282 | } | |
| 21854 | |||
| 21855 | 478 | static bool compat_qr_hide_bottom_pixels(const zquestheader& header) | |
| 21856 | { | ||
| 21857 | // 2.55.9 or newer? | ||
| 21858 |
2/2✓ Branch 0 taken 153 times.
✓ Branch 1 taken 325 times.
|
478 | if (header.compareVer(2, 55, 9) >= 0) |
| 21859 | 153 | return false; // defer to whatever was set | |
| 21860 | |||
| 21861 | // Replays created in 2.55 for quests prior to 2.55.9 should continue hiding the bottom pixels. | ||
| 21862 |
12/18✓ Branch 0 taken 50 times.
✓ Branch 1 taken 275 times.
✓ Branch 2 taken 275 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 275 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 50 times.
✓ Branch 7 taken 275 times.
✓ Branch 8 taken 50 times.
✓ Branch 9 taken 275 times.
✓ Branch 10 taken 50 times.
✓ Branch 11 taken 275 times.
✓ Branch 12 taken 37 times.
✓ Branch 13 taken 288 times.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
|
325 | if (replay_is_replaying() && replay_get_meta_str("zc_version_created").starts_with("2.55")) |
| 21863 | 37 | return true; | |
| 21864 | |||
| 21865 | // Quests prior to 2.55.9 with a scripted subscreen? | ||
| 21866 |
2/2✓ Branch 0 taken 145923 times.
✓ Branch 1 taken 285 times.
|
146208 | for (int i = 0; i < MAXDMAPS; i++) |
| 21867 | { | ||
| 21868 | 145923 | int script = DMaps[i].active_sub_script; | |
| 21869 |
4/6✓ Branch 0 taken 3 times.
✓ Branch 1 taken 145920 times.
✓ Branch 2 taken 3 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 3 times.
|
145923 | if (script && dmapscripts[script] && dmapscripts[script]->valid()) |
| 21870 | 3 | return true; | |
| 21871 | 145920 | } | |
| 21872 | |||
| 21873 | // Only a couple quests take any time (~7ms) on my intel mac to check all the ZASM... cache those. | ||
| 21874 |
1/2✓ Branch 0 taken 285 times.
✗ Branch 1 not taken.
|
285 | std::string title = header.title; |
| 21875 |
3/4✓ Branch 0 taken 285 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 3 times.
✓ Branch 3 taken 282 times.
|
285 | if (title == "Yuurand: Tales of the Labyrinth") |
| 21876 | 3 | return true; | |
| 21877 | |||
| 21878 | // Look for ZASM setting values of 167, 168, etc. This is a sign that the script may be drawing something | ||
| 21879 | // near the old "bottom" of the screen, or is attempting to fill the entire screen with a draw command. | ||
| 21880 | // In these cases, the compat rule must be flipped on. As of writing, 72 quests in the PZC database match | ||
| 21881 | // this query: https://gist.github.com/connorjclark/edd12f84c9aac0c924ed328d3f8efcfa | ||
| 21882 | 282 | bool found = false; | |
| 21883 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 282 times.
|
8764 | _zasm_for_every_script([&](auto script){ |
| 21884 |
2/2✓ Branch 0 taken 3033 times.
✓ Branch 1 taken 5449 times.
|
8482 | if (found) return; |
| 21885 | |||
| 21886 |
2/2✓ Branch 0 taken 5419 times.
✓ Branch 1 taken 23840130 times.
|
23845549 | for (const auto& instr : script->zasm) |
| 21887 | { | ||
| 21888 |
4/4✓ Branch 0 taken 20882211 times.
✓ Branch 1 taken 2957919 times.
✓ Branch 2 taken 358211 times.
✓ Branch 3 taken 20524000 times.
|
23840130 | if (!(instr.command == SETV || instr.command == PUSHV)) continue; |
| 21889 | |||
| 21890 | 3316130 | int value = instr.arg2; | |
| 21891 |
9/10✓ Branch 0 taken 3316128 times.
✓ Branch 1 taken 2 times.
✓ Branch 2 taken 3316125 times.
✓ Branch 3 taken 3 times.
✓ Branch 4 taken 3316101 times.
✓ Branch 5 taken 24 times.
✓ Branch 6 taken 3316101 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 1 times.
✓ Branch 9 taken 3316100 times.
|
3316130 | if (value == 167000000 || value == 168000000 || value == 167870000 || value == 167910000 || value == 168130000) |
| 21892 | { | ||
| 21893 | 30 | found = true; | |
| 21894 | 30 | break; | |
| 21895 | } | ||
| 21896 | } | ||
| 21897 | 8482 | }); | |
| 21898 | |||
| 21899 | 282 | return found; | |
| 21900 | 478 | } | |
| 21901 | |||
| 21902 | static int32_t prev_quest_format[versiontypesLAST]; | ||
| 21903 | static byte prev_quest_rules[QUESTRULES_NEW_SIZE]; | ||
| 21904 | static byte prev_extra_rules[EXTRARULES_SIZE]; | ||
| 21905 | static byte prev_midi_flags[MIDIFLAGS_SIZE]; | ||
| 21906 | static word prev_map_count; | ||
| 21907 | |||
| 21908 | // When skipping any section, we are loading a qst file just to poke at a couple things. | ||
| 21909 | // We should not mutate important globals in that case. | ||
| 21910 | // We should also restore these globals when loading a qst fails. | ||
| 21911 | // Globals that are read by usecases of `skip_flags` will have to be restored manually by the caller | ||
| 21912 | // (see load_imagebuf). | ||
| 21913 | 800 | static void store_prev_qstload_global_state() | |
| 21914 | { | ||
| 21915 | 800 | memcpy(prev_quest_rules, quest_rules, QUESTRULES_NEW_SIZE); | |
| 21916 | 800 | memcpy(prev_extra_rules, extra_rules, EXTRARULES_SIZE); | |
| 21917 | 800 | memcpy(prev_midi_flags, midi_flags, MIDIFLAGS_SIZE); | |
| 21918 | 800 | memcpy(prev_quest_format, FFCore.quest_format, versiontypesLAST); | |
| 21919 | 800 | prev_map_count = map_count; | |
| 21920 | 800 | } | |
| 21921 | |||
| 21922 | 322 | static void restore_prev_qstload_global_state() | |
| 21923 | { | ||
| 21924 | 322 | memcpy(quest_rules, prev_quest_rules, QUESTRULES_NEW_SIZE); | |
| 21925 | 322 | memcpy(extra_rules, prev_extra_rules, EXTRARULES_SIZE); | |
| 21926 | 322 | unpack_qrs(); | |
| 21927 | 322 | memcpy(midi_flags, prev_midi_flags, MIDIFLAGS_SIZE); | |
| 21928 | 322 | memcpy(FFCore.quest_format, prev_quest_format, versiontypesLAST); | |
| 21929 | 322 | map_count = prev_map_count; | |
| 21930 | 322 | } | |
| 21931 | |||
| 21932 | //Internal function for loadquest wrapper | ||
| 21933 | // TODO: refactor to never mutate global state, to make loading partial qst files easier and less error prone. huge project. | ||
| 21934 | 800 | static int32_t _lq_int(const char *filename, zquestheader *Header, miscQdata *Misc, zctune *tunes, bool show_progress, byte *skip_flags, byte printmetadata) | |
| 21935 | { | ||
| 21936 | 800 | DMapEditorLastMaptileUsed = 0; | |
| 21937 | 800 | combosread=false; | |
| 21938 | 800 | mapsread=false; | |
| 21939 | 800 | fixffcs=false; | |
| 21940 | |||
| 21941 | 800 | store_prev_qstload_global_state(); | |
| 21942 | |||
| 21943 | 800 | bool skipping_any = false; | |
| 21944 |
2/2✓ Branch 0 taken 3200 times.
✓ Branch 1 taken 800 times.
|
4000 | for (int i = 0; i < 4; i++) |
| 21945 | 3200 | skipping_any |= skip_flags[i] ? true : false; | |
| 21946 | |||
| 21947 | 800 | bool do_clear_scripts = !get_bit(skip_flags,skip_ffscript); | |
| 21948 |
1/2✓ Branch 0 taken 800 times.
✗ Branch 1 not taken.
|
800 | if(loading_tileset_flags & TILESET_CLEARSCRIPTS) |
| 21949 | { | ||
| 21950 | ✗ | set_bit(skip_flags, skip_ffscript, 1); | |
| 21951 | ✗ | setZScriptVersion(V_FFSCRIPT); | |
| 21952 | ✗ | FFCore.quest_format[vFFScript] = V_FFSCRIPT; | |
| 21953 | ✗ | FFCore.quest_format[vLastCompile] = V_FFSCRIPT; | |
| 21954 | ✗ | do_clear_scripts = true; | |
| 21955 | ✗ | } | |
| 21956 |
1/2✓ Branch 0 taken 800 times.
✗ Branch 1 not taken.
|
800 | if(loading_tileset_flags & TILESET_CLEARMAPS) |
| 21957 | { | ||
| 21958 | ✗ | set_bit(skip_flags, skip_maps, 1); | |
| 21959 | ✗ | } | |
| 21960 | |||
| 21961 | char tmpfilename[L_tmpnam]; | ||
| 21962 | 800 | temp_name(tmpfilename); | |
| 21963 | 800 | bool catchup=false; | |
| 21964 | byte tempbyte; | ||
| 21965 | |||
| 21966 | // oldquest flag is set when an unencrypted qst file is suspected. | ||
| 21967 | 800 | bool oldquest = false; | |
| 21968 | 800 | int32_t open_error=0; | |
| 21969 | 800 | PACKFILE *f=open_quest_file(&open_error, filename, show_progress); | |
| 21970 | |||
| 21971 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 800 times.
|
800 | if (!f) |
| 21972 | { | ||
| 21973 | ASSERT(open_error != 0); | ||
| 21974 | ✗ | return open_error; | |
| 21975 | } | ||
| 21976 | |||
| 21977 | 800 | memset(quest_rules, 0, QUESTRULES_NEW_SIZE); | |
| 21978 | 800 | memset(extra_rules, 0, EXTRARULES_SIZE); | |
| 21979 | 800 | unpack_qrs(); | |
| 21980 | |||
| 21981 |
2/2✓ Branch 0 taken 322 times.
✓ Branch 1 taken 478 times.
|
800 | if (!get_bit(skip_flags, skip_maps)) |
| 21982 | 478 | Regions = {}; | |
| 21983 | |||
| 21984 |
2/2✓ Branch 0 taken 322 times.
✓ Branch 1 taken 478 times.
|
800 | if(do_clear_scripts) |
| 21985 | { | ||
| 21986 | 478 | zScript.clear(); | |
| 21987 | 478 | globalmap.clear(); | |
| 21988 | 478 | genericmap.clear(); | |
| 21989 | 478 | ffcmap.clear(); | |
| 21990 | 478 | itemmap.clear(); | |
| 21991 | 478 | npcmap.clear(); | |
| 21992 | 478 | ewpnmap.clear(); | |
| 21993 | 478 | lwpnmap.clear(); | |
| 21994 | 478 | playermap.clear(); | |
| 21995 | 478 | dmapmap.clear(); | |
| 21996 | 478 | screenmap.clear(); | |
| 21997 | 478 | itemspritemap.clear(); | |
| 21998 | 478 | comboscriptmap.clear(); | |
| 21999 | 478 | subscreenmap.clear(); | |
| 22000 | |||
| 22001 |
2/2✓ Branch 0 taken 244258 times.
✓ Branch 1 taken 478 times.
|
244736 | for(int32_t i=0; i<NUMSCRIPTFFC-1; i++) |
| 22002 | { | ||
| 22003 | 244258 | ffcmap[i].clear(); | |
| 22004 | 244258 | } | |
| 22005 | |||
| 22006 | 478 | globalmap[0].slotname = "Slot 1:"; | |
| 22007 | 478 | globalmap[0].scriptname = "~Init"; | |
| 22008 | 478 | globalmap[0].update(); | |
| 22009 | |||
| 22010 |
2/2✓ Branch 0 taken 3346 times.
✓ Branch 1 taken 478 times.
|
3824 | for(int32_t i=1; i<NUMSCRIPTGLOBAL; i++) |
| 22011 | { | ||
| 22012 | 3346 | globalmap[i].clear(); | |
| 22013 | 3346 | } | |
| 22014 | |||
| 22015 |
2/2✓ Branch 0 taken 121890 times.
✓ Branch 1 taken 478 times.
|
122368 | for(int32_t i=0; i<NUMSCRIPTITEM-1; i++) |
| 22016 | { | ||
| 22017 | 121890 | itemmap[i].clear(); | |
| 22018 | 121890 | } | |
| 22019 | |||
| 22020 | //new script types -- prevent carrying over to a quest that you load after reading them | ||
| 22021 | //e.g., a quest has an npc script, and you make a blank quest, that now believes that it has an npc script, too! | ||
| 22022 |
2/2✓ Branch 0 taken 121890 times.
✓ Branch 1 taken 478 times.
|
122368 | for(int32_t i=0; i<NUMSCRIPTGUYS-1; i++) |
| 22023 | { | ||
| 22024 | 121890 | npcmap[i].clear(); | |
| 22025 | 121890 | } | |
| 22026 |
2/2✓ Branch 0 taken 121890 times.
✓ Branch 1 taken 478 times.
|
122368 | for(int32_t i=0; i<NUMSCRIPTWEAPONS-1; i++) |
| 22027 | { | ||
| 22028 | 121890 | lwpnmap[i].clear(); | |
| 22029 | 121890 | } | |
| 22030 |
2/2✓ Branch 0 taken 121890 times.
✓ Branch 1 taken 478 times.
|
122368 | for(int32_t i=0; i<NUMSCRIPTWEAPONS-1; i++) |
| 22031 | { | ||
| 22032 | 121890 | ewpnmap[i].clear(); | |
| 22033 | 121890 | } | |
| 22034 |
2/2✓ Branch 0 taken 1912 times.
✓ Branch 1 taken 478 times.
|
2390 | for(int32_t i=0; i<NUMSCRIPTHERO-1; i++) |
| 22035 | { | ||
| 22036 | 1912 | playermap[i].clear(); | |
| 22037 | 1912 | } | |
| 22038 |
2/2✓ Branch 0 taken 121890 times.
✓ Branch 1 taken 478 times.
|
122368 | for(int32_t i=0; i<NUMSCRIPTSDMAP-1; i++) |
| 22039 | { | ||
| 22040 | 121890 | dmapmap[i].clear(); | |
| 22041 | 121890 | } | |
| 22042 |
2/2✓ Branch 0 taken 121890 times.
✓ Branch 1 taken 478 times.
|
122368 | for(int32_t i=0; i<NUMSCRIPTSCREEN-1; i++) |
| 22043 | { | ||
| 22044 | 121890 | screenmap[i].clear(); | |
| 22045 | 121890 | } | |
| 22046 |
2/2✓ Branch 0 taken 121890 times.
✓ Branch 1 taken 478 times.
|
122368 | for(int32_t i=0; i<NUMSCRIPTSITEMSPRITE-1; i++) |
| 22047 | { | ||
| 22048 | 121890 | itemspritemap[i].clear(); | |
| 22049 | 121890 | } | |
| 22050 |
2/2✓ Branch 0 taken 244258 times.
✓ Branch 1 taken 478 times.
|
244736 | for(int32_t i=0; i<NUMSCRIPTSCOMBODATA-1; i++) |
| 22051 | { | ||
| 22052 | 244258 | comboscriptmap[i].clear(); | |
| 22053 | 244258 | } | |
| 22054 |
2/2✓ Branch 0 taken 244258 times.
✓ Branch 1 taken 478 times.
|
244736 | for(int32_t i=0; i<NUMSCRIPTSGENERIC-1; i++) |
| 22055 | { | ||
| 22056 | 244258 | genericmap[i].clear(); | |
| 22057 | 244258 | } | |
| 22058 |
2/2✓ Branch 0 taken 121890 times.
✓ Branch 1 taken 478 times.
|
122368 | for(int32_t i=0; i<NUMSCRIPTSSUBSCREEN-1; i++) |
| 22059 | { | ||
| 22060 | 121890 | subscreenmap[i].clear(); | |
| 22061 | 121890 | } | |
| 22062 | |||
| 22063 | 478 | reset_scripts(); | |
| 22064 | 478 | } | |
| 22065 | |||
| 22066 | 800 | zquestheader tempheader{}; | |
| 22067 |
1/2✓ Branch 0 taken 800 times.
✗ Branch 1 not taken.
|
800 | tempheader.filename = filename; |
| 22068 |
1/2✓ Branch 0 taken 800 times.
✗ Branch 1 not taken.
|
800 | zinfo tempzi; |
| 22069 |
1/2✓ Branch 0 taken 800 times.
✗ Branch 1 not taken.
|
800 | tempzi.clear(); |
| 22070 | 800 | load_tmp_zi = &tempzi; | |
| 22071 | |||
| 22072 | char zinfofilename[2048]; | ||
| 22073 |
1/2✓ Branch 0 taken 800 times.
✗ Branch 1 not taken.
|
800 | replace_extension(zinfofilename, filename, "zinfo", 2047); |
| 22074 | 800 | int32_t ret=0; | |
| 22075 | |||
| 22076 | //header | ||
| 22077 |
1/2✓ Branch 0 taken 800 times.
✗ Branch 1 not taken.
|
800 | box_out("Reading Header..."); |
| 22078 |
1/2✓ Branch 0 taken 800 times.
✗ Branch 1 not taken.
|
800 | ret=readheader(f, &tempheader, printmetadata); |
| 22079 |
1/9✗ Branch 0 not taken.
✓ Branch 1 taken 800 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
|
800 | checkstatus(ret); |
| 22080 |
1/2✓ Branch 0 taken 800 times.
✗ Branch 1 not taken.
|
800 | box_out("okay."); |
| 22081 |
1/2✓ Branch 0 taken 800 times.
✗ Branch 1 not taken.
|
800 | box_eol(); |
| 22082 | |||
| 22083 |
2/2✓ Branch 0 taken 196 times.
✓ Branch 1 taken 604 times.
|
800 | if(read_zinfo) |
| 22084 | { | ||
| 22085 |
1/2✓ Branch 0 taken 196 times.
✗ Branch 1 not taken.
|
196 | box_out("Reading ZInfo - "); |
| 22086 |
3/4✓ Branch 0 taken 2 times.
✓ Branch 1 taken 194 times.
✓ Branch 2 taken 196 times.
✗ Branch 3 not taken.
|
196 | box_out(read_ext_zinfo ? "External..." : "Internal..."); |
| 22087 |
2/2✓ Branch 0 taken 2 times.
✓ Branch 1 taken 194 times.
|
196 | if(read_ext_zinfo) |
| 22088 | { | ||
| 22089 |
1/2✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
|
2 | PACKFILE *inf=pack_fopen_password(zinfofilename, F_READ, ""); |
| 22090 |
1/2✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
|
2 | ret=readzinfo(inf, tempzi, tempheader); |
| 22091 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
2 | if(inf) pack_fclose(inf); |
| 22092 |
1/9✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
|
2 | checkstatus(ret); |
| 22093 | 2 | } | |
| 22094 | else | ||
| 22095 | { | ||
| 22096 |
1/2✓ Branch 0 taken 194 times.
✗ Branch 1 not taken.
|
194 | ret=readzinfo(f, tempzi, tempheader); |
| 22097 |
1/9✗ Branch 0 not taken.
✓ Branch 1 taken 194 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
|
194 | checkstatus(ret); |
| 22098 | } | ||
| 22099 |
1/2✓ Branch 0 taken 196 times.
✗ Branch 1 not taken.
|
196 | box_out("okay."); |
| 22100 |
1/2✓ Branch 0 taken 196 times.
✗ Branch 1 not taken.
|
196 | box_eol(); |
| 22101 | 196 | } | |
| 22102 | |||
| 22103 |
2/2✓ Branch 0 taken 776 times.
✓ Branch 1 taken 24 times.
|
800 | if(tempheader.zelda_version>=0x193) |
| 22104 | { | ||
| 22105 | dword section_id; | ||
| 22106 | |||
| 22107 | //section id | ||
| 22108 |
2/4✓ Branch 0 taken 776 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 776 times.
✗ Branch 3 not taken.
|
776 | if(!p_mgetl(§ion_id,f)) |
| 22109 | { | ||
| 22110 | ✗ | goto invalid; | |
| 22111 | } | ||
| 22112 | |||
| 22113 | 776 | std::set<dword> seen_sections; | |
| 22114 | |||
| 22115 |
3/4✓ Branch 0 taken 18869 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 18093 times.
✓ Branch 3 taken 776 times.
|
18869 | while(!pack_feof(f)) |
| 22116 | { | ||
| 22117 |
2/4✓ Branch 0 taken 18093 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 18093 times.
✗ Branch 3 not taken.
|
18093 | if (seen_sections.contains(section_id)) |
| 22118 | ✗ | goto invalid; | |
| 22119 |
1/2✓ Branch 0 taken 18093 times.
✗ Branch 1 not taken.
|
18093 | seen_sections.insert(section_id); |
| 22120 | |||
| 22121 |
3/4✓ Branch 0 taken 18093 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 11352 times.
✓ Branch 3 taken 6741 times.
|
18093 | if (int retval = maybe_skip_section(f, section_id, skip_flags); retval != qe_OK) |
| 22122 | { | ||
| 22123 |
1/2✓ Branch 0 taken 6741 times.
✗ Branch 1 not taken.
|
6741 | if (retval == qe_cancel) |
| 22124 | 6741 | continue; | |
| 22125 | ✗ | checkstatus(retval); | |
| 22126 | ✗ | } | |
| 22127 | |||
| 22128 |
24/25✓ Branch 0 taken 455 times.
✓ Branch 1 taken 455 times.
✓ Branch 2 taken 776 times.
✓ Branch 3 taken 776 times.
✓ Branch 4 taken 455 times.
✓ Branch 5 taken 396 times.
✓ Branch 6 taken 776 times.
✓ Branch 7 taken 455 times.
✓ Branch 8 taken 455 times.
✓ Branch 9 taken 455 times.
✓ Branch 10 taken 455 times.
✓ Branch 11 taken 455 times.
✓ Branch 12 taken 396 times.
✓ Branch 13 taken 396 times.
✓ Branch 14 taken 455 times.
✓ Branch 15 taken 455 times.
✓ Branch 16 taken 396 times.
✓ Branch 17 taken 396 times.
✓ Branch 18 taken 396 times.
✓ Branch 19 taken 396 times.
✓ Branch 20 taken 455 times.
✓ Branch 21 taken 455 times.
✓ Branch 22 taken 396 times.
✓ Branch 23 taken 396 times.
✗ Branch 24 not taken.
|
11352 | switch(section_id) |
| 22129 | { | ||
| 22130 | case ID_RULES: | ||
| 22131 | |||
| 22132 | //rules | ||
| 22133 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 455 times.
|
455 | if(catchup) |
| 22134 | { | ||
| 22135 | ✗ | box_out("found."); | |
| 22136 | ✗ | box_eol(); | |
| 22137 | ✗ | catchup=false; | |
| 22138 | ✗ | } | |
| 22139 | |||
| 22140 |
1/2✓ Branch 0 taken 455 times.
✗ Branch 1 not taken.
|
455 | box_out("Reading Rules..."); |
| 22141 |
1/2✓ Branch 0 taken 455 times.
✗ Branch 1 not taken.
|
455 | ret=readrules(f, &tempheader); |
| 22142 |
1/9✗ Branch 0 not taken.
✓ Branch 1 taken 455 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
|
455 | checkstatus(ret); |
| 22143 |
1/2✓ Branch 0 taken 455 times.
✗ Branch 1 not taken.
|
455 | box_out("okay."); |
| 22144 |
1/2✓ Branch 0 taken 455 times.
✗ Branch 1 not taken.
|
455 | box_eol(); |
| 22145 | 455 | break; | |
| 22146 | |||
| 22147 | case ID_STRINGS: | ||
| 22148 | |||
| 22149 | //strings | ||
| 22150 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 455 times.
|
455 | if(catchup) |
| 22151 | { | ||
| 22152 | ✗ | box_out("found."); | |
| 22153 | ✗ | box_eol(); | |
| 22154 | ✗ | catchup=false; | |
| 22155 | ✗ | } | |
| 22156 | |||
| 22157 |
1/2✓ Branch 0 taken 455 times.
✗ Branch 1 not taken.
|
455 | box_out("Reading Strings..."); |
| 22158 |
1/2✓ Branch 0 taken 455 times.
✗ Branch 1 not taken.
|
455 | ret=readstrings(f, &tempheader); |
| 22159 |
1/9✗ Branch 0 not taken.
✓ Branch 1 taken 455 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
|
455 | checkstatus(ret); |
| 22160 |
1/2✓ Branch 0 taken 455 times.
✗ Branch 1 not taken.
|
455 | box_out("okay."); |
| 22161 |
1/2✓ Branch 0 taken 455 times.
✗ Branch 1 not taken.
|
455 | box_eol(); |
| 22162 | 455 | break; | |
| 22163 | |||
| 22164 | case ID_MISC: | ||
| 22165 | |||
| 22166 | //misc data | ||
| 22167 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 776 times.
|
776 | if(catchup) |
| 22168 | { | ||
| 22169 | ✗ | box_out("found."); | |
| 22170 | ✗ | box_eol(); | |
| 22171 | ✗ | catchup=false; | |
| 22172 | ✗ | } | |
| 22173 | |||
| 22174 |
1/2✓ Branch 0 taken 776 times.
✗ Branch 1 not taken.
|
776 | box_out("Reading Misc. Data..."); |
| 22175 |
1/2✓ Branch 0 taken 776 times.
✗ Branch 1 not taken.
|
776 | ret=readmisc(f, &tempheader, Misc); |
| 22176 |
1/9✗ Branch 0 not taken.
✓ Branch 1 taken 776 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
|
776 | checkstatus(ret); |
| 22177 |
1/2✓ Branch 0 taken 776 times.
✗ Branch 1 not taken.
|
776 | box_out("okay."); |
| 22178 |
1/2✓ Branch 0 taken 776 times.
✗ Branch 1 not taken.
|
776 | box_eol(); |
| 22179 | 776 | break; | |
| 22180 | |||
| 22181 | case ID_TILES: | ||
| 22182 | |||
| 22183 | //tiles | ||
| 22184 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 776 times.
|
776 | if(catchup) |
| 22185 | { | ||
| 22186 | ✗ | box_out("found."); | |
| 22187 | ✗ | box_eol(); | |
| 22188 | ✗ | catchup=false; | |
| 22189 | ✗ | } | |
| 22190 | |||
| 22191 |
1/2✓ Branch 0 taken 776 times.
✗ Branch 1 not taken.
|
776 | box_out("Reading Tiles..."); |
| 22192 |
1/2✓ Branch 0 taken 776 times.
✗ Branch 1 not taken.
|
776 | ret=readtiles(f, newtilebuf, &tempheader, tempheader.zelda_version, tempheader.build, 0, NEWMAXTILES, false); |
| 22193 |
1/9✗ Branch 0 not taken.
✓ Branch 1 taken 776 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
|
776 | checkstatus(ret); |
| 22194 |
1/2✓ Branch 0 taken 776 times.
✗ Branch 1 not taken.
|
776 | box_out("okay."); |
| 22195 |
1/2✓ Branch 0 taken 776 times.
✗ Branch 1 not taken.
|
776 | box_eol(); |
| 22196 | 776 | break; | |
| 22197 | |||
| 22198 | case ID_COMBOS: | ||
| 22199 | |||
| 22200 | //combos | ||
| 22201 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 455 times.
|
455 | if(catchup) |
| 22202 | { | ||
| 22203 | ✗ | box_out("found."); | |
| 22204 | ✗ | box_eol(); | |
| 22205 | ✗ | catchup=false; | |
| 22206 | ✗ | } | |
| 22207 | |||
| 22208 |
1/2✓ Branch 0 taken 455 times.
✗ Branch 1 not taken.
|
455 | box_out("Reading Combos..."); |
| 22209 |
1/2✓ Branch 0 taken 455 times.
✗ Branch 1 not taken.
|
455 | ret=readcombos(f, &tempheader, tempheader.zelda_version, tempheader.build, 0, MAXCOMBOS); |
| 22210 | 455 | combosread=true; | |
| 22211 |
1/9✗ Branch 0 not taken.
✓ Branch 1 taken 455 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
|
455 | checkstatus(ret); |
| 22212 |
1/2✓ Branch 0 taken 455 times.
✗ Branch 1 not taken.
|
455 | box_out("okay."); |
| 22213 |
1/2✓ Branch 0 taken 455 times.
✗ Branch 1 not taken.
|
455 | box_eol(); |
| 22214 | 455 | break; | |
| 22215 | |||
| 22216 | case ID_COMBOALIASES: | ||
| 22217 | |||
| 22218 | //combo aliases | ||
| 22219 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 396 times.
|
396 | if(catchup) |
| 22220 | { | ||
| 22221 | ✗ | box_out("found."); | |
| 22222 | ✗ | box_eol(); | |
| 22223 | ✗ | catchup=false; | |
| 22224 | ✗ | } | |
| 22225 | |||
| 22226 |
1/2✓ Branch 0 taken 396 times.
✗ Branch 1 not taken.
|
396 | box_out("Reading Combo Aliases..."); |
| 22227 |
1/2✓ Branch 0 taken 396 times.
✗ Branch 1 not taken.
|
396 | ret=readcomboaliases(f, &tempheader, tempheader.zelda_version, tempheader.build); |
| 22228 |
1/9✗ Branch 0 not taken.
✓ Branch 1 taken 396 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
|
396 | checkstatus(ret); |
| 22229 |
1/2✓ Branch 0 taken 396 times.
✗ Branch 1 not taken.
|
396 | box_out("okay."); |
| 22230 |
1/2✓ Branch 0 taken 396 times.
✗ Branch 1 not taken.
|
396 | box_eol(); |
| 22231 | 396 | break; | |
| 22232 | |||
| 22233 | case ID_CSETS: | ||
| 22234 | |||
| 22235 | //color data | ||
| 22236 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 776 times.
|
776 | if(catchup) |
| 22237 | { | ||
| 22238 | ✗ | box_out("found."); | |
| 22239 | ✗ | box_eol(); | |
| 22240 | ✗ | catchup=false; | |
| 22241 | ✗ | } | |
| 22242 | |||
| 22243 |
1/2✓ Branch 0 taken 776 times.
✗ Branch 1 not taken.
|
776 | box_out("Reading Color Data..."); |
| 22244 |
1/2✓ Branch 0 taken 776 times.
✗ Branch 1 not taken.
|
776 | ret=readcolordata(f, Misc, tempheader.zelda_version, tempheader.build, 0, newerpdTOTAL); |
| 22245 |
1/9✗ Branch 0 not taken.
✓ Branch 1 taken 776 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
|
776 | checkstatus(ret); |
| 22246 |
1/2✓ Branch 0 taken 776 times.
✗ Branch 1 not taken.
|
776 | box_out("okay."); |
| 22247 |
1/2✓ Branch 0 taken 776 times.
✗ Branch 1 not taken.
|
776 | box_eol(); |
| 22248 | 776 | break; | |
| 22249 | |||
| 22250 | case ID_MAPS: | ||
| 22251 | |||
| 22252 | //maps | ||
| 22253 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 455 times.
|
455 | if(catchup) |
| 22254 | { | ||
| 22255 | ✗ | box_out("found."); | |
| 22256 | ✗ | box_eol(); | |
| 22257 | ✗ | catchup=false; | |
| 22258 | ✗ | } | |
| 22259 | |||
| 22260 |
1/2✓ Branch 0 taken 455 times.
✗ Branch 1 not taken.
|
455 | box_out("Reading Maps..."); |
| 22261 |
1/2✓ Branch 0 taken 455 times.
✗ Branch 1 not taken.
|
455 | ret=readmaps(f, &tempheader); |
| 22262 | 455 | mapsread=true; | |
| 22263 |
1/9✗ Branch 0 not taken.
✓ Branch 1 taken 455 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
|
455 | checkstatus(ret); |
| 22264 |
1/2✓ Branch 0 taken 455 times.
✗ Branch 1 not taken.
|
455 | box_out("okay."); |
| 22265 |
1/2✓ Branch 0 taken 455 times.
✗ Branch 1 not taken.
|
455 | box_eol(); |
| 22266 | 455 | break; | |
| 22267 | |||
| 22268 | case ID_DMAPS: | ||
| 22269 | |||
| 22270 | //dmaps | ||
| 22271 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 455 times.
|
455 | if(catchup) |
| 22272 | { | ||
| 22273 | ✗ | box_out("found."); | |
| 22274 | ✗ | box_eol(); | |
| 22275 | ✗ | catchup=false; | |
| 22276 | ✗ | } | |
| 22277 | |||
| 22278 |
1/2✓ Branch 0 taken 455 times.
✗ Branch 1 not taken.
|
455 | box_out("Reading DMaps..."); |
| 22279 |
1/2✓ Branch 0 taken 455 times.
✗ Branch 1 not taken.
|
455 | ret=readdmaps(f, &tempheader, tempheader.zelda_version, tempheader.build, 0, MAXDMAPS); |
| 22280 |
1/9✗ Branch 0 not taken.
✓ Branch 1 taken 455 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
|
455 | checkstatus(ret); |
| 22281 |
1/2✓ Branch 0 taken 455 times.
✗ Branch 1 not taken.
|
455 | box_out("okay."); |
| 22282 |
1/2✓ Branch 0 taken 455 times.
✗ Branch 1 not taken.
|
455 | box_eol(); |
| 22283 | 455 | break; | |
| 22284 | |||
| 22285 | case ID_DOORS: | ||
| 22286 | |||
| 22287 | //door combo sets | ||
| 22288 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 455 times.
|
455 | if(catchup) |
| 22289 | { | ||
| 22290 | ✗ | box_out("found."); | |
| 22291 | ✗ | box_eol(); | |
| 22292 | ✗ | catchup=false; | |
| 22293 | ✗ | } | |
| 22294 | |||
| 22295 |
1/2✓ Branch 0 taken 455 times.
✗ Branch 1 not taken.
|
455 | box_out("Reading Doors..."); |
| 22296 |
1/2✓ Branch 0 taken 455 times.
✗ Branch 1 not taken.
|
455 | ret=readdoorcombosets(f, &tempheader); |
| 22297 |
1/9✗ Branch 0 not taken.
✓ Branch 1 taken 455 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
|
455 | checkstatus(ret); |
| 22298 |
1/2✓ Branch 0 taken 455 times.
✗ Branch 1 not taken.
|
455 | box_out("okay."); |
| 22299 |
1/2✓ Branch 0 taken 455 times.
✗ Branch 1 not taken.
|
455 | box_eol(); |
| 22300 | 455 | break; | |
| 22301 | |||
| 22302 | case ID_ITEMS: | ||
| 22303 | |||
| 22304 | //items | ||
| 22305 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 455 times.
|
455 | if(catchup) |
| 22306 | { | ||
| 22307 | ✗ | box_out("found."); | |
| 22308 | ✗ | box_eol(); | |
| 22309 | ✗ | catchup=false; | |
| 22310 | ✗ | } | |
| 22311 | |||
| 22312 |
1/2✓ Branch 0 taken 455 times.
✗ Branch 1 not taken.
|
455 | box_out("Reading Items..."); |
| 22313 |
1/2✓ Branch 0 taken 455 times.
✗ Branch 1 not taken.
|
455 | ret=readitems(f, tempheader.zelda_version, tempheader.build); |
| 22314 |
1/9✗ Branch 0 not taken.
✓ Branch 1 taken 455 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
|
455 | checkstatus(ret); |
| 22315 | |||
| 22316 |
1/2✓ Branch 0 taken 455 times.
✗ Branch 1 not taken.
|
455 | box_out("okay."); |
| 22317 |
1/2✓ Branch 0 taken 455 times.
✗ Branch 1 not taken.
|
455 | box_eol(); |
| 22318 | 455 | break; | |
| 22319 | |||
| 22320 | case ID_WEAPONS: | ||
| 22321 | |||
| 22322 | //weapons | ||
| 22323 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 455 times.
|
455 | if(catchup) |
| 22324 | { | ||
| 22325 | ✗ | box_out("found."); | |
| 22326 | ✗ | box_eol(); | |
| 22327 | ✗ | catchup=false; | |
| 22328 | ✗ | } | |
| 22329 | |||
| 22330 |
1/2✓ Branch 0 taken 455 times.
✗ Branch 1 not taken.
|
455 | box_out("Reading Weapons..."); |
| 22331 |
1/2✓ Branch 0 taken 455 times.
✗ Branch 1 not taken.
|
455 | ret=readweapons(f, &tempheader); |
| 22332 |
1/9✗ Branch 0 not taken.
✓ Branch 1 taken 455 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
|
455 | checkstatus(ret); |
| 22333 |
1/2✓ Branch 0 taken 455 times.
✗ Branch 1 not taken.
|
455 | box_out("okay."); |
| 22334 |
1/2✓ Branch 0 taken 455 times.
✗ Branch 1 not taken.
|
455 | box_eol(); |
| 22335 | 455 | break; | |
| 22336 | |||
| 22337 | case ID_COLORS: | ||
| 22338 | |||
| 22339 | //misc. colors | ||
| 22340 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 396 times.
|
396 | if(catchup) |
| 22341 | { | ||
| 22342 | ✗ | box_out("found."); | |
| 22343 | ✗ | box_eol(); | |
| 22344 | ✗ | catchup=false; | |
| 22345 | ✗ | } | |
| 22346 | |||
| 22347 |
1/2✓ Branch 0 taken 396 times.
✗ Branch 1 not taken.
|
396 | box_out("Reading Misc. Colors..."); |
| 22348 |
1/2✓ Branch 0 taken 396 times.
✗ Branch 1 not taken.
|
396 | ret=readmisccolors(f, &tempheader, Misc); |
| 22349 |
1/9✗ Branch 0 not taken.
✓ Branch 1 taken 396 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
|
396 | checkstatus(ret); |
| 22350 |
1/2✓ Branch 0 taken 396 times.
✗ Branch 1 not taken.
|
396 | box_out("okay."); |
| 22351 |
1/2✓ Branch 0 taken 396 times.
✗ Branch 1 not taken.
|
396 | box_eol(); |
| 22352 | 396 | break; | |
| 22353 | |||
| 22354 | case ID_ICONS: | ||
| 22355 | |||
| 22356 | //game icons | ||
| 22357 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 396 times.
|
396 | if(catchup) |
| 22358 | { | ||
| 22359 | ✗ | box_out("found."); | |
| 22360 | ✗ | box_eol(); | |
| 22361 | ✗ | catchup=false; | |
| 22362 | ✗ | } | |
| 22363 | |||
| 22364 |
1/2✓ Branch 0 taken 396 times.
✗ Branch 1 not taken.
|
396 | box_out("Reading Game Icons..."); |
| 22365 |
1/2✓ Branch 0 taken 396 times.
✗ Branch 1 not taken.
|
396 | ret=readgameicons(f, &tempheader, Misc); |
| 22366 |
1/9✗ Branch 0 not taken.
✓ Branch 1 taken 396 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
|
396 | checkstatus(ret); |
| 22367 |
1/2✓ Branch 0 taken 396 times.
✗ Branch 1 not taken.
|
396 | box_out("okay."); |
| 22368 |
1/2✓ Branch 0 taken 396 times.
✗ Branch 1 not taken.
|
396 | box_eol(); |
| 22369 | 396 | break; | |
| 22370 | |||
| 22371 | case ID_INITDATA: | ||
| 22372 | |||
| 22373 | //initialization data | ||
| 22374 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 455 times.
|
455 | if(catchup) |
| 22375 | { | ||
| 22376 | ✗ | box_out("found."); | |
| 22377 | ✗ | box_eol(); | |
| 22378 | ✗ | catchup=false; | |
| 22379 | ✗ | } | |
| 22380 | |||
| 22381 |
1/2✓ Branch 0 taken 455 times.
✗ Branch 1 not taken.
|
455 | box_out("Reading Init. Data..."); |
| 22382 |
1/2✓ Branch 0 taken 455 times.
✗ Branch 1 not taken.
|
455 | ret=readinitdata(f, &tempheader); |
| 22383 |
1/9✗ Branch 0 not taken.
✓ Branch 1 taken 455 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
|
455 | checkstatus(ret); |
| 22384 |
1/2✓ Branch 0 taken 455 times.
✗ Branch 1 not taken.
|
455 | box_out("okay."); |
| 22385 |
1/2✓ Branch 0 taken 455 times.
✗ Branch 1 not taken.
|
455 | box_eol(); |
| 22386 | |||
| 22387 |
2/4✓ Branch 0 taken 455 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 455 times.
|
455 | if(!get_bit(skip_flags, skip_subscreens)) |
| 22388 | { | ||
| 22389 |
2/2✓ Branch 0 taken 94 times.
✓ Branch 1 taken 361 times.
|
455 | if(subscr_mode!=ssdtMAX) //not using custom subscreens |
| 22390 | { | ||
| 22391 |
1/2✓ Branch 0 taken 94 times.
✗ Branch 1 not taken.
|
94 | setupsubscreens(); |
| 22392 | |||
| 22393 |
2/2✓ Branch 0 taken 48128 times.
✓ Branch 1 taken 94 times.
|
48222 | for(int32_t i=0; i<MAXDMAPS; ++i) |
| 22394 | { | ||
| 22395 | 48128 | int32_t type=DMaps[i].type&dmfTYPE; | |
| 22396 |
2/2✓ Branch 0 taken 1086 times.
✓ Branch 1 taken 47042 times.
|
48128 | DMaps[i].active_subscreen=(type == dmOVERW || type == dmBSOVERW)?0:1; |
| 22397 | 48128 | DMaps[i].passive_subscreen=(get_qr(qr_ENABLEMAGIC))?0:1; | |
| 22398 | 48128 | } | |
| 22399 | 94 | } | |
| 22400 | 455 | } | |
| 22401 | |||
| 22402 |
2/4✓ Branch 0 taken 455 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 455 times.
✗ Branch 3 not taken.
|
455 | if(!get_bit(skip_flags, skip_sfx)) |
| 22403 | { | ||
| 22404 | 455 | setupsfx(); | |
| 22405 | 455 | } | |
| 22406 | |||
| 22407 |
2/4✓ Branch 0 taken 455 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 455 times.
✗ Branch 3 not taken.
|
455 | if(!get_bit(skip_flags, skip_itemdropsets)) |
| 22408 | { | ||
| 22409 |
1/2✓ Branch 0 taken 455 times.
✗ Branch 1 not taken.
|
455 | init_item_drop_sets(); |
| 22410 | 455 | } | |
| 22411 | |||
| 22412 |
2/4✓ Branch 0 taken 455 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 455 times.
|
455 | if(!get_bit(skip_flags, skip_favorites)) |
| 22413 | { | ||
| 22414 | 455 | init_favorites(); | |
| 22415 | 455 | } | |
| 22416 | |||
| 22417 | 455 | break; | |
| 22418 | |||
| 22419 | case ID_GUYS: | ||
| 22420 | |||
| 22421 | //guys | ||
| 22422 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 455 times.
|
455 | if(catchup) |
| 22423 | { | ||
| 22424 | ✗ | box_out("found."); | |
| 22425 | ✗ | box_eol(); | |
| 22426 | ✗ | catchup=false; | |
| 22427 | ✗ | } | |
| 22428 | |||
| 22429 |
1/2✓ Branch 0 taken 455 times.
✗ Branch 1 not taken.
|
455 | box_out("Reading Custom Guy Data..."); |
| 22430 |
1/2✓ Branch 0 taken 455 times.
✗ Branch 1 not taken.
|
455 | ret=readguys(f, &tempheader); |
| 22431 |
1/9✗ Branch 0 not taken.
✓ Branch 1 taken 455 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
|
455 | checkstatus(ret); |
| 22432 |
1/2✓ Branch 0 taken 455 times.
✗ Branch 1 not taken.
|
455 | box_out("okay."); |
| 22433 |
1/2✓ Branch 0 taken 455 times.
✗ Branch 1 not taken.
|
455 | box_eol(); |
| 22434 | 455 | break; | |
| 22435 | |||
| 22436 | case ID_HEROSPRITES: | ||
| 22437 | |||
| 22438 | //hero sprites | ||
| 22439 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 396 times.
|
396 | if(catchup) |
| 22440 | { | ||
| 22441 | ✗ | box_out("found."); | |
| 22442 | ✗ | box_eol(); | |
| 22443 | ✗ | catchup=false; | |
| 22444 | ✗ | } | |
| 22445 | |||
| 22446 |
1/2✓ Branch 0 taken 396 times.
✗ Branch 1 not taken.
|
396 | box_out("Reading Custom Hero Sprite Data..."); |
| 22447 |
1/2✓ Branch 0 taken 396 times.
✗ Branch 1 not taken.
|
396 | ret=readherosprites(f, &tempheader); |
| 22448 |
1/9✗ Branch 0 not taken.
✓ Branch 1 taken 396 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
|
396 | checkstatus(ret); |
| 22449 |
1/2✓ Branch 0 taken 396 times.
✗ Branch 1 not taken.
|
396 | box_out("okay."); |
| 22450 |
1/2✓ Branch 0 taken 396 times.
✗ Branch 1 not taken.
|
396 | box_eol(); |
| 22451 | 396 | break; | |
| 22452 | |||
| 22453 | case ID_SUBSCREEN: | ||
| 22454 | |||
| 22455 | //custom subscreens | ||
| 22456 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 396 times.
|
396 | if(catchup) |
| 22457 | { | ||
| 22458 | ✗ | box_out("found."); | |
| 22459 | ✗ | box_eol(); | |
| 22460 | ✗ | catchup=false; | |
| 22461 | ✗ | } | |
| 22462 | |||
| 22463 |
1/2✓ Branch 0 taken 396 times.
✗ Branch 1 not taken.
|
396 | box_out("Reading Custom Subscreen Data..."); |
| 22464 |
1/2✓ Branch 0 taken 396 times.
✗ Branch 1 not taken.
|
396 | ret=readsubscreens(f); |
| 22465 |
1/9✗ Branch 0 not taken.
✓ Branch 1 taken 396 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
|
396 | checkstatus(ret); |
| 22466 |
1/2✓ Branch 0 taken 396 times.
✗ Branch 1 not taken.
|
396 | box_out("okay."); |
| 22467 |
1/2✓ Branch 0 taken 396 times.
✗ Branch 1 not taken.
|
396 | box_eol(); |
| 22468 | 396 | break; | |
| 22469 | |||
| 22470 | case ID_FFSCRIPT: | ||
| 22471 | |||
| 22472 | //Freeform combo scripts | ||
| 22473 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 396 times.
|
396 | if(catchup) |
| 22474 | { | ||
| 22475 | ✗ | box_out("found."); | |
| 22476 | ✗ | box_eol(); | |
| 22477 | ✗ | catchup=false; | |
| 22478 | ✗ | } | |
| 22479 | |||
| 22480 |
1/2✓ Branch 0 taken 396 times.
✗ Branch 1 not taken.
|
396 | box_out("Reading FF Script Data..."); |
| 22481 |
1/2✓ Branch 0 taken 396 times.
✗ Branch 1 not taken.
|
396 | ret=readffscript(f, &tempheader); |
| 22482 |
1/9✗ Branch 0 not taken.
✓ Branch 1 taken 396 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
|
396 | checkstatus(ret); |
| 22483 |
1/2✓ Branch 0 taken 396 times.
✗ Branch 1 not taken.
|
396 | box_out("okay."); |
| 22484 |
1/2✓ Branch 0 taken 396 times.
✗ Branch 1 not taken.
|
396 | box_eol(); |
| 22485 | 396 | break; | |
| 22486 | |||
| 22487 | case ID_SFX: | ||
| 22488 | |||
| 22489 | //SFX data | ||
| 22490 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 396 times.
|
396 | if(catchup) |
| 22491 | { | ||
| 22492 | ✗ | box_out("found."); | |
| 22493 | ✗ | box_eol(); | |
| 22494 | ✗ | catchup=false; | |
| 22495 | ✗ | } | |
| 22496 | |||
| 22497 |
1/2✓ Branch 0 taken 396 times.
✗ Branch 1 not taken.
|
396 | box_out("Reading SFX Data..."); |
| 22498 |
1/2✓ Branch 0 taken 396 times.
✗ Branch 1 not taken.
|
396 | ret=readsfx(f, &tempheader); |
| 22499 |
1/9✗ Branch 0 not taken.
✓ Branch 1 taken 396 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
|
396 | checkstatus(ret); |
| 22500 |
1/2✓ Branch 0 taken 396 times.
✗ Branch 1 not taken.
|
396 | box_out("okay."); |
| 22501 |
1/2✓ Branch 0 taken 396 times.
✗ Branch 1 not taken.
|
396 | box_eol(); |
| 22502 | 396 | break; | |
| 22503 | |||
| 22504 | case ID_MIDIS: | ||
| 22505 | |||
| 22506 | //midis | ||
| 22507 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 455 times.
|
455 | if(catchup) |
| 22508 | { | ||
| 22509 | ✗ | box_out("found."); | |
| 22510 | ✗ | box_eol(); | |
| 22511 | ✗ | catchup=false; | |
| 22512 | ✗ | } | |
| 22513 | |||
| 22514 |
1/2✓ Branch 0 taken 455 times.
✗ Branch 1 not taken.
|
455 | box_out("Reading Tunes..."); |
| 22515 |
1/2✓ Branch 0 taken 455 times.
✗ Branch 1 not taken.
|
455 | ret=readtunes(f, &tempheader, tunes); |
| 22516 |
1/9✗ Branch 0 not taken.
✓ Branch 1 taken 455 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
|
455 | checkstatus(ret); |
| 22517 |
1/2✓ Branch 0 taken 455 times.
✗ Branch 1 not taken.
|
455 | box_out("okay."); |
| 22518 |
1/2✓ Branch 0 taken 455 times.
✗ Branch 1 not taken.
|
455 | box_eol(); |
| 22519 | 455 | break; | |
| 22520 | |||
| 22521 | case ID_CHEATS: | ||
| 22522 | |||
| 22523 | //cheat codes | ||
| 22524 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 455 times.
|
455 | if(catchup) |
| 22525 | { | ||
| 22526 | ✗ | box_out("found."); | |
| 22527 | ✗ | box_eol(); | |
| 22528 | ✗ | catchup=false; | |
| 22529 | ✗ | } | |
| 22530 | |||
| 22531 |
1/2✓ Branch 0 taken 455 times.
✗ Branch 1 not taken.
|
455 | box_out("Reading Cheat Codes..."); |
| 22532 |
1/2✓ Branch 0 taken 455 times.
✗ Branch 1 not taken.
|
455 | ret=readcheatcodes(f, &tempheader); |
| 22533 |
1/9✗ Branch 0 not taken.
✓ Branch 1 taken 455 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
|
455 | checkstatus(ret); |
| 22534 |
1/2✓ Branch 0 taken 455 times.
✗ Branch 1 not taken.
|
455 | box_out("okay."); |
| 22535 |
1/2✓ Branch 0 taken 455 times.
✗ Branch 1 not taken.
|
455 | box_eol(); |
| 22536 | 455 | break; | |
| 22537 | |||
| 22538 | case ID_ITEMDROPSETS: | ||
| 22539 | |||
| 22540 | //item drop sets | ||
| 22541 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 396 times.
|
396 | if(catchup) |
| 22542 | { | ||
| 22543 | ✗ | box_out("found."); | |
| 22544 | ✗ | box_eol(); | |
| 22545 | ✗ | catchup=false; | |
| 22546 | ✗ | } | |
| 22547 | |||
| 22548 |
1/2✓ Branch 0 taken 396 times.
✗ Branch 1 not taken.
|
396 | box_out("Reading Item Drop Sets..."); |
| 22549 |
1/2✓ Branch 0 taken 396 times.
✗ Branch 1 not taken.
|
396 | ret=readitemdropsets(f, tempheader.zelda_version); |
| 22550 |
1/9✗ Branch 0 not taken.
✓ Branch 1 taken 396 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
|
396 | checkstatus(ret); |
| 22551 |
1/2✓ Branch 0 taken 396 times.
✗ Branch 1 not taken.
|
396 | box_out("okay."); |
| 22552 |
1/2✓ Branch 0 taken 396 times.
✗ Branch 1 not taken.
|
396 | box_eol(); |
| 22553 | 396 | break; | |
| 22554 | |||
| 22555 | case ID_FAVORITES: | ||
| 22556 | |||
| 22557 | //favorite combos and combo aliases | ||
| 22558 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 396 times.
|
396 | if(catchup) |
| 22559 | { | ||
| 22560 | ✗ | box_out("found."); | |
| 22561 | ✗ | box_eol(); | |
| 22562 | ✗ | catchup=false; | |
| 22563 | ✗ | } | |
| 22564 | |||
| 22565 |
1/2✓ Branch 0 taken 396 times.
✗ Branch 1 not taken.
|
396 | box_out("Reading Favorite Combos..."); |
| 22566 |
1/2✓ Branch 0 taken 396 times.
✗ Branch 1 not taken.
|
396 | ret=readfavorites(f, tempheader.zelda_version); |
| 22567 |
1/9✗ Branch 0 not taken.
✓ Branch 1 taken 396 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
|
396 | checkstatus(ret); |
| 22568 |
1/2✓ Branch 0 taken 396 times.
✗ Branch 1 not taken.
|
396 | box_out("okay."); |
| 22569 |
1/2✓ Branch 0 taken 396 times.
✗ Branch 1 not taken.
|
396 | box_eol(); |
| 22570 | 396 | break; | |
| 22571 | |||
| 22572 | default: | ||
| 22573 | ✗ | if(!catchup) | |
| 22574 | { | ||
| 22575 | ✗ | box_out("Bad token! Searching..."); | |
| 22576 | ✗ | box_eol(); | |
| 22577 | ✗ | } | |
| 22578 | |||
| 22579 | ✗ | catchup=true; | |
| 22580 | ✗ | break; | |
| 22581 | } | ||
| 22582 | |||
| 22583 | |||
| 22584 |
1/2✓ Branch 0 taken 11352 times.
✗ Branch 1 not taken.
|
11352 | if(catchup) |
| 22585 | { | ||
| 22586 | //section id | ||
| 22587 | ✗ | section_id=(section_id<<8); | |
| 22588 | |||
| 22589 | ✗ | if(!p_getc(&tempbyte,f)) | |
| 22590 | { | ||
| 22591 | ✗ | goto invalid; | |
| 22592 | } | ||
| 22593 | |||
| 22594 | ✗ | section_id+=tempbyte; | |
| 22595 | ✗ | } | |
| 22596 | |||
| 22597 | else | ||
| 22598 | { | ||
| 22599 | //section id | ||
| 22600 |
3/4✓ Branch 0 taken 11352 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 10897 times.
✓ Branch 3 taken 455 times.
|
11352 | if(!pack_feof(f)) |
| 22601 | { | ||
| 22602 |
2/4✓ Branch 0 taken 10897 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 10897 times.
✗ Branch 3 not taken.
|
10897 | if(!p_mgetl(§ion_id,f)) |
| 22603 | { | ||
| 22604 | ✗ | goto invalid; | |
| 22605 | } | ||
| 22606 | 10897 | } | |
| 22607 | } | ||
| 22608 | } | ||
| 22609 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 776 times.
|
776 | } |
| 22610 | else | ||
| 22611 | { | ||
| 22612 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
24 | std::vector<std::tuple<std::string, int32_t, std::function<int32_t()>>> hardcoded_sections = { |
| 22613 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
47 | { "Rules", ID_RULES, [&](){ return readrules(f, &tempheader); }}, |
| 22614 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
48 | { "Strings", ID_STRINGS, [&](){ return readstrings(f, &tempheader); }}, |
| 22615 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
48 | { "Doors", ID_DOORS, [&](){ return readdoorcombosets(f, &tempheader); }}, |
| 22616 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
48 | { "DMaps", ID_DMAPS, [&](){ return readdmaps(f, &tempheader, tempheader.zelda_version, tempheader.build, 0, MAXDMAPS); }}, |
| 22617 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
48 | { "Misc. Data", ID_MISC, [&](){ return readmisc(f, &tempheader, Misc); }}, |
| 22618 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
48 | { "Items", ID_ITEMS, [&](){ return readitems(f, tempheader.zelda_version, tempheader.build); }}, |
| 22619 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
48 | { "Weapons", ID_WEAPONS, [&](){ return readweapons(f, &tempheader); }}, |
| 22620 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
47 | { "Custom Guy Data", ID_GUYS, [&](){ return readguys(f, &tempheader); }}, |
| 22621 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
48 | { "Maps", ID_MAPS, [&](){ return readmaps(f, &tempheader); }}, |
| 22622 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
48 | { "Combos", ID_COMBOS, [&](){ return readcombos(f, &tempheader, tempheader.zelda_version, tempheader.build, 0, MAXCOMBOS); }}, |
| 22623 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
48 | { "Color Data", ID_CSETS, [&](){ return readcolordata(f, Misc, tempheader.zelda_version, tempheader.build, 0, newerpdTOTAL); }}, |
| 22624 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
48 | { "Tiles", ID_TILES, [&](){ return readtiles(f, newtilebuf, &tempheader, tempheader.zelda_version, tempheader.build, 0, NEWMAXTILES, false); }}, |
| 22625 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
47 | { "Tunes", ID_MIDIS, [&](){ return readtunes(f, &tempheader, tunes); }}, |
| 22626 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
47 | { "Cheat Codes", ID_CHEATS, [&](){ return readcheatcodes(f, &tempheader); }}, |
| 22627 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
47 | { "Init. Data", ID_INITDATA, [&](){ return readinitdata(f, &tempheader); }}, |
| 22628 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
47 | { "Custom Hero Sprite Data", ID_HEROSPRITES, [&](){ return readherosprites2(f, -1); }}, |
| 22629 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
47 | { "Up Default Item Drop Sets", ID_ITEMDROPSETS, [&](){ return readitemdropsets(f, -1); }}, |
| 22630 | }; | ||
| 22631 | |||
| 22632 | 24 | legacy_skip_flags = skip_flags; | |
| 22633 |
2/2✓ Branch 0 taken 24 times.
✓ Branch 1 taken 408 times.
|
1250 | for (auto& [desc, section_id, fn] : hardcoded_sections) |
| 22634 | { | ||
| 22635 |
1/2✓ Branch 0 taken 408 times.
✗ Branch 1 not taken.
|
408 | int section_enum = section_id_to_enum(section_id); |
| 22636 |
2/4✓ Branch 0 taken 408 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 408 times.
✗ Branch 3 not taken.
|
408 | bool skip = section_enum >= 0 && get_bit(skip_flags, section_enum); |
| 22637 |
2/2✓ Branch 0 taken 392 times.
✓ Branch 1 taken 16 times.
|
408 | if (skip) |
| 22638 | { | ||
| 22639 | // Nothing to read. | ||
| 22640 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 15 times.
|
16 | if (section_id == ID_RULES) |
| 22641 | 1 | continue; | |
| 22642 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 14 times.
|
15 | if (section_id == ID_GUYS) |
| 22643 | 1 | continue; | |
| 22644 | |||
| 22645 | // Haven't looked at how to skip these, because we don't need to currently: the only | ||
| 22646 | // usage of skip_flags currently is all off except: header and tiles (see `load_imagebuf`). | ||
| 22647 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 13 times.
|
14 | if (section_id == ID_MIDIS) |
| 22648 | 1 | continue; | |
| 22649 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 12 times.
|
13 | if (section_id == ID_CHEATS) |
| 22650 | 1 | continue; | |
| 22651 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 11 times.
|
12 | if (section_id == ID_INITDATA) |
| 22652 | 1 | continue; | |
| 22653 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 10 times.
|
11 | if (section_id == ID_HEROSPRITES) |
| 22654 | 1 | continue; | |
| 22655 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 9 times.
|
10 | if (section_id == ID_ITEMDROPSETS) |
| 22656 | 1 | continue; | |
| 22657 | 9 | } | |
| 22658 | |||
| 22659 | // Would be nice, but old sections mostly did not save section sizes. We could advance by | ||
| 22660 | // a specific amount, but it'd be a lot of work to get it right. So, for old quests, let's just | ||
| 22661 | // read all the sections even if requested to skip some. | ||
| 22662 | // if (int retval = maybe_skip_section(f, section_id, skip_flags); retval != qe_OK) | ||
| 22663 | // { | ||
| 22664 | // if (retval == qe_cancel) | ||
| 22665 | // continue; | ||
| 22666 | // checkstatus(retval); | ||
| 22667 | // } | ||
| 22668 | |||
| 22669 |
3/6✓ Branch 0 taken 401 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 401 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 401 times.
✗ Branch 5 not taken.
|
802 | box_out(fmt::format("Reading {}...", desc).c_str()); |
| 22670 |
1/2✓ Branch 0 taken 401 times.
✗ Branch 1 not taken.
|
401 | ret = fn(); |
| 22671 |
1/9✗ Branch 0 not taken.
✓ Branch 1 taken 401 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
|
401 | checkstatus(ret); |
| 22672 |
1/2✓ Branch 0 taken 401 times.
✗ Branch 1 not taken.
|
401 | box_out("okay."); |
| 22673 |
1/2✓ Branch 0 taken 401 times.
✗ Branch 1 not taken.
|
401 | box_eol(); |
| 22674 | } | ||
| 22675 | 24 | legacy_skip_flags = nullptr; | |
| 22676 | |||
| 22677 |
3/4✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 23 times.
✓ Branch 3 taken 1 times.
|
24 | if(!get_bit(skip_flags, skip_subscreens)) |
| 22678 | { | ||
| 22679 |
1/2✓ Branch 0 taken 23 times.
✗ Branch 1 not taken.
|
23 | setupsubscreens(); |
| 22680 | |||
| 22681 |
2/2✓ Branch 0 taken 11776 times.
✓ Branch 1 taken 23 times.
|
11799 | for(int32_t i=0; i<MAXDMAPS; ++i) |
| 22682 | { | ||
| 22683 | 11776 | int32_t type=DMaps[i].type&dmfTYPE; | |
| 22684 |
2/2✓ Branch 0 taken 44 times.
✓ Branch 1 taken 11732 times.
|
11776 | DMaps[i].active_subscreen=(type == dmOVERW || type == dmBSOVERW)?0:1; |
| 22685 | 11776 | DMaps[i].passive_subscreen=(get_qr(qr_ENABLEMAGIC))?0:1; | |
| 22686 | 11776 | } | |
| 22687 | 23 | } | |
| 22688 | |||
| 22689 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
24 | box_out("Setting Up Default Sound Effects..."); |
| 22690 | |||
| 22691 |
3/4✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 23 times.
|
24 | if(!get_bit(skip_flags, skip_sfx)) |
| 22692 | 23 | setupsfx(); | |
| 22693 | |||
| 22694 |
3/4✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 23 times.
✓ Branch 3 taken 1 times.
|
24 | if(!get_bit(skip_flags, skip_favorites)) |
| 22695 | 23 | init_favorites(); | |
| 22696 | |||
| 22697 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
24 | box_out("okay."); |
| 22698 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
24 | box_eol(); |
| 22699 |
1/3✗ Branch 0 not taken.
✗ Branch 1 not taken.
✓ Branch 2 taken 24 times.
|
24 | } |
| 22700 | |||
| 22701 |
1/2✓ Branch 0 taken 800 times.
✗ Branch 1 not taken.
|
800 | init_spritelists(); |
| 22702 | |||
| 22703 | // check data | ||
| 22704 |
1/2✓ Branch 0 taken 800 times.
✗ Branch 1 not taken.
|
800 | if(f) |
| 22705 | { | ||
| 22706 |
1/2✓ Branch 0 taken 800 times.
✗ Branch 1 not taken.
|
800 | pack_fclose(f); |
| 22707 | 800 | } | |
| 22708 |
1/2✓ Branch 0 taken 800 times.
✗ Branch 1 not taken.
|
800 | clear_quest_tmpfile(); |
| 22709 | |||
| 22710 |
1/2✓ Branch 0 taken 800 times.
✗ Branch 1 not taken.
|
800 | if(!oldquest) |
| 22711 | { | ||
| 22712 |
2/4✓ Branch 0 taken 800 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 800 times.
|
800 | if(exists(tmpfilename)) |
| 22713 | { | ||
| 22714 | ✗ | delete_file(tmpfilename); | |
| 22715 | ✗ | } | |
| 22716 | 800 | } | |
| 22717 | |||
| 22718 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 800 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
800 | if(fixffcs && combosread && mapsread) |
| 22719 | { | ||
| 22720 | ✗ | for(int32_t i=0; i<map_count; i++) | |
| 22721 | { | ||
| 22722 | ✗ | for(int32_t j=0; j<MAPSCRS; j++) | |
| 22723 | { | ||
| 22724 | ✗ | int c = TheMaps[(i*MAPSCRS)+j].numFFC(); | |
| 22725 | ✗ | for(int32_t m=0; m<c; m++) | |
| 22726 | { | ||
| 22727 | ✗ | if(combobuf[TheMaps[(i*MAPSCRS)+j].ffcs[m].data].type == cCHANGE) | |
| 22728 | ✗ | TheMaps[(i*MAPSCRS)+j].ffcs[m].flags|=ffc_changer; | |
| 22729 | ✗ | } | |
| 22730 | ✗ | } | |
| 22731 | ✗ | } | |
| 22732 | ✗ | } | |
| 22733 | |||
| 22734 |
3/4✓ Branch 0 taken 800 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 478 times.
✓ Branch 3 taken 322 times.
|
800 | if (!get_bit(skip_flags, skip_rules)) |
| 22735 | { | ||
| 22736 |
1/2✓ Branch 0 taken 478 times.
✗ Branch 1 not taken.
|
478 | bool should_hide = compat_qr_hide_bottom_pixels(tempheader); |
| 22737 |
1/2✓ Branch 0 taken 478 times.
✗ Branch 1 not taken.
|
478 | al_trace("Note: qr_HIDE_BOTTOM_8_PIXELS %s via compat rule\n", should_hide ? "enabled" : "disabled"); |
| 22738 |
2/2✓ Branch 0 taken 73 times.
✓ Branch 1 taken 405 times.
|
478 | if (should_hide) |
| 22739 |
1/2✓ Branch 0 taken 73 times.
✗ Branch 1 not taken.
|
73 | set_qr(qr_HIDE_BOTTOM_8_PIXELS, 1); |
| 22740 | |||
| 22741 |
3/4✓ Branch 0 taken 344 times.
✓ Branch 1 taken 134 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 344 times.
|
478 | if (FFCore.quest_format[vCompatRule] < 77 && Header->is_z3) |
| 22742 | ✗ | set_qr(qr_LAYER6_STRINGS_OVER_SUBSCREEN, 1); | |
| 22743 | 478 | } | |
| 22744 | |||
| 22745 |
7/10✓ Branch 0 taken 63 times.
✓ Branch 1 taken 737 times.
✓ Branch 2 taken 63 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 62 times.
✓ Branch 5 taken 1 times.
✓ Branch 6 taken 62 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 62 times.
✗ Branch 9 not taken.
|
800 | if(get_qr(qr_CONTFULL_DEP) && !get_bit(skip_flags, skip_rules) && !get_bit(skip_flags, skip_initdata)) |
| 22746 | { | ||
| 22747 |
1/2✓ Branch 0 taken 62 times.
✗ Branch 1 not taken.
|
62 | set_qr(qr_CONTFULL_DEP, 0); |
| 22748 |
1/2✓ Branch 0 taken 62 times.
✗ Branch 1 not taken.
|
62 | zinit.flags.set(INIT_FL_CONTPERCENT,true); |
| 22749 | 62 | zinit.cont_heart=100; | |
| 22750 | 62 | zinit.counter[crLIFE]=zinit.mcounter[crLIFE]; | |
| 22751 | 62 | } | |
| 22752 | |||
| 22753 |
1/2✓ Branch 0 taken 800 times.
✗ Branch 1 not taken.
|
800 | box_out("Done."); |
| 22754 |
1/2✓ Branch 0 taken 800 times.
✗ Branch 1 not taken.
|
800 | box_eol(); |
| 22755 |
1/2✓ Branch 0 taken 800 times.
✗ Branch 1 not taken.
|
800 | box_end(false); |
| 22756 | |||
| 22757 |
3/4✓ Branch 0 taken 800 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 479 times.
✓ Branch 3 taken 321 times.
|
800 | if(!get_bit(skip_flags, skip_header)) |
| 22758 | { | ||
| 22759 |
1/2✓ Branch 0 taken 479 times.
✗ Branch 1 not taken.
|
479 | *Header = tempheader; |
| 22760 | 479 | } | |
| 22761 |
3/4✓ Branch 0 taken 800 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 478 times.
✓ Branch 3 taken 322 times.
|
800 | if(!get_bit(skip_flags, skip_zinfo)) |
| 22762 | { | ||
| 22763 |
1/2✓ Branch 0 taken 478 times.
✗ Branch 1 not taken.
|
478 | ZI.copyFrom(tempzi); |
| 22764 | 478 | } | |
| 22765 | |||
| 22766 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 800 times.
|
800 | if(loading_tileset_flags & TILESET_CLEARMAPS) |
| 22767 | { | ||
| 22768 | ✗ | TheMaps.clear(); | |
| 22769 | ✗ | TheMaps.resize(MAPSCRS*1); | |
| 22770 | ✗ | map_count = 1; | |
| 22771 | ✗ | map_autolayers.clear(); | |
| 22772 | ✗ | map_autolayers.resize(6*1); | |
| 22773 | ✗ | } | |
| 22774 | |||
| 22775 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 800 times.
|
800 | if(loading_tileset_flags & TILESET_CLEARHEADER) |
| 22776 | { | ||
| 22777 | ✗ | memset(Header->password, 0, sizeof(Header->password)); | |
| 22778 | ✗ | memset(Header->minver, 0, sizeof(Header->minver)); | |
| 22779 | ✗ | memset(Header->title, 0, sizeof(Header->title)); | |
| 22780 | ✗ | memset(Header->author, 0, sizeof(Header->author)); | |
| 22781 | ✗ | memset(Header->version, 0, sizeof(Header->version)); | |
| 22782 | ✗ | Header->use_keyfile = 0; | |
| 22783 | ✗ | Header->dirty_password = false; | |
| 22784 | cvs_MD5Context ctx; | ||
| 22785 | ✗ | cvs_MD5Init(&ctx); | |
| 22786 | ✗ | cvs_MD5Update(&ctx, (const uint8_t*)"", 0); | |
| 22787 | ✗ | cvs_MD5Final(Header->pwd_hash, &ctx); | |
| 22788 | ✗ | } | |
| 22789 | |||
| 22790 |
3/4✓ Branch 0 taken 800 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 478 times.
✓ Branch 3 taken 322 times.
|
800 | if (!get_bit(skip_flags, skip_maps)) |
| 22791 | { | ||
| 22792 | // Not needed, so release its memory. | ||
| 22793 |
1/2✓ Branch 0 taken 478 times.
✗ Branch 1 not taken.
|
478 | old_combo_pages = {}; |
| 22794 | 478 | } | |
| 22795 | |||
| 22796 |
2/2✓ Branch 0 taken 322 times.
✓ Branch 1 taken 478 times.
|
800 | if (skipping_any) |
| 22797 |
1/2✓ Branch 0 taken 322 times.
✗ Branch 1 not taken.
|
322 | restore_prev_qstload_global_state(); |
| 22798 | |||
| 22799 | 800 | return qe_OK; | |
| 22800 | |||
| 22801 | invalid: | ||
| 22802 | // TODO: It's too easy to forget to jump to this label, and accidentally leave the file open. | ||
| 22803 | // Should wrap PACKFILE in a std::unique_pointer with a custom deallocator. | ||
| 22804 | ✗ | box_out("error."); | |
| 22805 | ✗ | box_eol(); | |
| 22806 | ✗ | box_end(true); | |
| 22807 | |||
| 22808 | ✗ | pack_fclose(f); | |
| 22809 | |||
| 22810 | ✗ | if(!oldquest) | |
| 22811 | { | ||
| 22812 | ✗ | if(exists(tmpfilename)) | |
| 22813 | { | ||
| 22814 | ✗ | delete_file(tmpfilename); | |
| 22815 | ✗ | } | |
| 22816 | ✗ | } | |
| 22817 | |||
| 22818 | ✗ | restore_prev_qstload_global_state(); | |
| 22819 | |||
| 22820 | ✗ | return qe_invalid; | |
| 22821 | |||
| 22822 | 800 | } | |
| 22823 | |||
| 22824 | static bool _is_loading_quest; | ||
| 22825 | |||
| 22826 | ✗ | bool is_loading_quest() | |
| 22827 | { | ||
| 22828 | ✗ | return _is_loading_quest; | |
| 22829 | } | ||
| 22830 | |||
| 22831 | 321 | std::string get_last_loaded_qstpath() | |
| 22832 | { | ||
| 22833 | 321 | return last_loaded_qstpath; | |
| 22834 | } | ||
| 22835 | |||
| 22836 | 800 | int32_t loadquest(const char *filename, zquestheader *Header, miscQdata *Misc, | |
| 22837 | zctune *tunes, bool show_progress, byte *skip_flags, byte printmetadata, | ||
| 22838 | bool report, byte qst_num, dword tilesetflags) | ||
| 22839 | { | ||
| 22840 | 800 | loading_tileset_flags = tilesetflags; | |
| 22841 | 800 | const char* basename = get_filename(filename); | |
| 22842 | 800 | zapp_reporting_add_breadcrumb("load_quest", basename); | |
| 22843 | 800 | zapp_reporting_set_tag("qst.filename", basename); | |
| 22844 | |||
| 22845 | 800 | last_loaded_qstpath = filename; | |
| 22846 | 800 | loading_qst_name = filename; | |
| 22847 | 800 | loading_qst_num = qst_num; | |
| 22848 | // In CI, builds are cached for replay tests, which can result in their build dates being earlier than what it would be locally. | ||
| 22849 | // So to avoid a more-recently updated .qst file from hitting the "last saved in a newer version" prompt, we disable in CI. | ||
| 22850 |
1/2✓ Branch 0 taken 800 times.
✗ Branch 1 not taken.
|
800 | if (!is_ci()) |
| 22851 | ✗ | loadquest_report = report; | |
| 22852 | |||
| 22853 | 800 | _is_loading_quest = true; | |
| 22854 | 800 | auto start = std::chrono::steady_clock::now(); | |
| 22855 | 800 | zprint2("Loading qst: %s\n", filename); | |
| 22856 | 800 | int32_t ret = _lq_int(filename, Header, Misc, tunes, show_progress, skip_flags, printmetadata); | |
| 22857 | 800 | int32_t load_ms = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::steady_clock::now() - start).count(); | |
| 22858 | 800 | zprint2("Time to load qst: %d ms\n", load_ms); | |
| 22859 | 800 | _is_loading_quest = false; | |
| 22860 |
1/2✓ Branch 0 taken 800 times.
✗ Branch 1 not taken.
|
800 | if (ret) |
| 22861 | ✗ | zprint2("Error: %s\n", qst_error[ret]); | |
| 22862 | |||
| 22863 |
1/2✓ Branch 0 taken 800 times.
✗ Branch 1 not taken.
|
800 | if(show_progress) |
| 22864 | { | ||
| 22865 | ✗ | if(ret) | |
| 22866 | { | ||
| 22867 | ✗ | box_out("-- Error loading quest file! --"); | |
| 22868 | ✗ | box_out(fmt::format("Error: {}", qst_error[ret]).c_str()); | |
| 22869 | ✗ | box_end(true); | |
| 22870 | ✗ | } | |
| 22871 | ✗ | else box_end(false); | |
| 22872 | ✗ | } | |
| 22873 | |||
| 22874 | 800 | load_tmp_zi = NULL; | |
| 22875 | 800 | loading_qst_name = NULL; | |
| 22876 | 800 | loadquest_report = false; | |
| 22877 | 800 | loading_qst_num = 0; | |
| 22878 | |||
| 22879 | 800 | zapp_reporting_set_tag("qst.author", Header->author); | |
| 22880 | 800 | zapp_reporting_set_tag("qst.title", Header->title); | |
| 22881 | 800 | zapp_reporting_set_tag("qst.zc_version", Header->getVerStr()); | |
| 22882 | |||
| 22883 | 800 | return ret; | |
| 22884 | ✗ | } | |
| 22885 |